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

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

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

enum  {
	XMPP_XEP_JET_MODULE_0_PROPERTY,
	XMPP_XEP_JET_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jet_module_properties[XMPP_XEP_JET_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
typedef struct _XmppXepJetModuleIsAvailableData XmppXepJetModuleIsAvailableData;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_xep_jet_transport_secret_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_jet_transport_secret_unref (var), NULL)))
enum  {
	XMPP_XEP_JET_OPTIONS_0_PROPERTY,
	XMPP_XEP_JET_OPTIONS_TYPE_URI_PROPERTY,
	XMPP_XEP_JET_OPTIONS_CIPHER_URI_PROPERTY,
	XMPP_XEP_JET_OPTIONS_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jet_options_properties[XMPP_XEP_JET_OPTIONS_NUM_PROPERTIES];
enum  {
	XMPP_XEP_JET_SECURITY_PARAMETERS_0_PROPERTY,
	XMPP_XEP_JET_SECURITY_PARAMETERS_CIPHER_PROPERTY,
	XMPP_XEP_JET_SECURITY_PARAMETERS_ENCODING_PROPERTY,
	XMPP_XEP_JET_SECURITY_PARAMETERS_SECRET_PROPERTY,
	XMPP_XEP_JET_SECURITY_PARAMETERS_OPTIONS_PROPERTY,
	XMPP_XEP_JET_SECURITY_PARAMETERS_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_NUM_PROPERTIES];

#define XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM (xmpp_xep_jet_encrypted_stream_get_type ())
#define XMPP_XEP_JET_ENCRYPTED_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM, XmppXepJetEncryptedStream))
#define XMPP_XEP_JET_ENCRYPTED_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM, XmppXepJetEncryptedStreamClass))
#define XMPP_XEP_JET_IS_ENCRYPTED_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM))
#define XMPP_XEP_JET_IS_ENCRYPTED_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM))
#define XMPP_XEP_JET_ENCRYPTED_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM, XmppXepJetEncryptedStreamClass))

typedef struct _XmppXepJetEncryptedStream XmppXepJetEncryptedStream;
typedef struct _XmppXepJetEncryptedStreamClass XmppXepJetEncryptedStreamClass;
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _XmppXepJetEncryptedStreamPrivate XmppXepJetEncryptedStreamPrivate;
enum  {
	XMPP_XEP_JET_ENCRYPTED_STREAM_0_PROPERTY,
	XMPP_XEP_JET_ENCRYPTED_STREAM_INPUT_STREAM_PROPERTY,
	XMPP_XEP_JET_ENCRYPTED_STREAM_OUTPUT_STREAM_PROPERTY,
	XMPP_XEP_JET_ENCRYPTED_STREAM_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jet_encrypted_stream_properties[XMPP_XEP_JET_ENCRYPTED_STREAM_NUM_PROPERTIES];
typedef struct _XmppXepJetParamSpecTransportSecret XmppXepJetParamSpecTransportSecret;
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

struct _XmppXepJetModulePrivate {
	GeeHashMap* envelop_encodings;
	GeeHashMap* ciphers;
};

struct _XmppXepJetModuleIsAvailableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepJetModule* self;
	XmppXmppStream* stream;
	XmppJid* full_jid;
	gboolean result;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	gboolean _tmp3_;
};

struct _XmppXepJetOptionsPrivate {
	gchar* _type_uri;
	gchar* _cipher_uri;
};

struct _XmppXepJetSecurityParametersPrivate {
	XmppXepJetCipher* _cipher;
	XmppXepJetEnvelopEncoding* _encoding;
	XmppXepJetTransportSecret* _secret;
	XmppXepJetOptions* _options;
};

struct _XmppXepJetEncryptedStream {
	GIOStream parent_instance;
	XmppXepJetEncryptedStreamPrivate * priv;
};

struct _XmppXepJetEncryptedStreamClass {
	GIOStreamClass parent_class;
};

struct _XmppXepJetEncryptedStreamPrivate {
	GIOStream* stream;
	GInputStream* input;
	GOutputStream* output;
};

struct _XmppXepJetTransportSecretPrivate {
	guint8* _transport_key;
	gint _transport_key_length1;
	gint __transport_key_size_;
	guint8* _initialization_vector;
	gint _initialization_vector_length1;
	gint __initialization_vector_size_;
};

struct _XmppXepJetParamSpecTransportSecret {
	GParamSpec parent_instance;
};

static gint XmppXepJetModule_private_offset;
static gpointer xmpp_xep_jet_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_jet_module_IDENTITY = NULL;
static XmppXepJingleSecurityPreconditionIface * xmpp_xep_jet_module_xmpp_xep_jingle_security_precondition_parent_iface = NULL;
static gint XmppXepJetOptions_private_offset;
static gpointer xmpp_xep_jet_options_parent_class = NULL;
static gint XmppXepJetSecurityParameters_private_offset;
static gpointer xmpp_xep_jet_security_parameters_parent_class = NULL;
static XmppXepJingleSecurityParametersIface * xmpp_xep_jet_security_parameters_xmpp_xep_jingle_security_parameters_parent_iface = NULL;
static gint XmppXepJetEncryptedStream_private_offset;
static gpointer xmpp_xep_jet_encrypted_stream_parent_class = NULL;
static gint XmppXepJetTransportSecret_private_offset;
static gpointer xmpp_xep_jet_transport_secret_parent_class = NULL;

static void xmpp_xep_jet_module_real_attach (XmppXmppStreamModule* base,
                                      XmppXmppStream* stream);
static void xmpp_xep_jet_module_real_detach (XmppXmppStreamModule* base,
                                      XmppXmppStream* stream);
static void xmpp_xep_jet_module_is_available_data_free (gpointer _data);
static gboolean xmpp_xep_jet_module_is_available_co (XmppXepJetModuleIsAvailableData* _data_);
static void xmpp_xep_jet_module_is_available_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
static gchar* xmpp_xep_jet_module_real_security_ns_uri (XmppXepJingleSecurityPrecondition* base);
static XmppXepJingleSecurityParameters* xmpp_xep_jet_module_real_create_security_parameters (XmppXepJingleSecurityPrecondition* base,
                                                                                      XmppXmppStream* stream,
                                                                                      XmppJid* local_full_jid,
                                                                                      XmppJid* peer_full_jid,
                                                                                      GObject* options,
                                                                                      GError** error);
static XmppXepJingleSecurityParameters* xmpp_xep_jet_module_real_parse_security_parameters (XmppXepJingleSecurityPrecondition* base,
                                                                                     XmppXmppStream* stream,
                                                                                     XmppJid* local_full_jid,
                                                                                     XmppJid* peer_full_jid,
                                                                                     XmppStanzaNode* security,
                                                                                     GError** error);
static gchar* xmpp_xep_jet_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_jet_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_xep_jet_module_finalize (GObject * obj);
static GType xmpp_xep_jet_module_get_type_once (void);
static void xmpp_xep_jet_options_set_type_uri (XmppXepJetOptions* self,
                                        const gchar* value);
static void xmpp_xep_jet_options_set_cipher_uri (XmppXepJetOptions* self,
                                          const gchar* value);
static void xmpp_xep_jet_options_finalize (GObject * obj);
static GType xmpp_xep_jet_options_get_type_once (void);
static void _vala_xmpp_xep_jet_options_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec);
static void _vala_xmpp_xep_jet_options_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec);
static void xmpp_xep_jet_security_parameters_set_cipher (XmppXepJetSecurityParameters* self,
                                                  XmppXepJetCipher* value);
static void xmpp_xep_jet_security_parameters_set_encoding (XmppXepJetSecurityParameters* self,
                                                    XmppXepJetEnvelopEncoding* value);
static void xmpp_xep_jet_security_parameters_set_secret (XmppXepJetSecurityParameters* self,
                                                  XmppXepJetTransportSecret* value);
static void xmpp_xep_jet_security_parameters_set_options (XmppXepJetSecurityParameters* self,
                                                   XmppXepJetOptions* value);
static gchar* xmpp_xep_jet_security_parameters_real_security_ns_uri (XmppXepJingleSecurityParameters* base);
static GIOStream* xmpp_xep_jet_security_parameters_real_wrap_stream (XmppXepJingleSecurityParameters* base,
                                                              GIOStream* stream);
VALA_EXTERN XmppXepJetEncryptedStream* xmpp_xep_jet_encrypted_stream_new (XmppXepJetCipher* cipher,
                                                              XmppXepJetTransportSecret* secret,
                                                              GIOStream* stream);
VALA_EXTERN XmppXepJetEncryptedStream* xmpp_xep_jet_encrypted_stream_construct (GType object_type,
                                                                    XmppXepJetCipher* cipher,
                                                                    XmppXepJetTransportSecret* secret,
                                                                    GIOStream* stream);
VALA_EXTERN GType xmpp_xep_jet_encrypted_stream_get_type (void) G_GNUC_CONST ;
static XmppStanzaNode* xmpp_xep_jet_security_parameters_real_to_security_stanza_node (XmppXepJingleSecurityParameters* base,
                                                                               XmppXmppStream* stream,
                                                                               XmppJid* local_full_jid,
                                                                               XmppJid* peer_full_jid);
static void xmpp_xep_jet_security_parameters_finalize (GObject * obj);
static GType xmpp_xep_jet_security_parameters_get_type_once (void);
static void _vala_xmpp_xep_jet_security_parameters_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_xmpp_xep_jet_security_parameters_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);
static GType xmpp_xep_jet_cipher_get_type_once (void);
static void xmpp_xep_jet_encrypted_stream_finalize (GObject * obj);
static GType xmpp_xep_jet_encrypted_stream_get_type_once (void);
static void _vala_xmpp_xep_jet_encrypted_stream_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void xmpp_xep_jet_transport_secret_set_transport_key (XmppXepJetTransportSecret* self,
                                                      guint8* value,
                                                      gint value_length1);
static void xmpp_xep_jet_transport_secret_set_initialization_vector (XmppXepJetTransportSecret* self,
                                                              guint8* value,
                                                              gint value_length1);
static guint8* _vala_array_dup13 (guint8* self,
                           gssize length);
static guint8* _vala_array_dup14 (guint8* self,
                           gssize length);
static void xmpp_xep_jet_transport_secret_finalize (XmppXepJetTransportSecret * obj);
static GType xmpp_xep_jet_transport_secret_get_type_once (void);
static GType xmpp_xep_jet_envelop_encoding_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_jet_module_get_instance_private (XmppXepJetModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJetModule_private_offset);
}

static void
xmpp_xep_jet_module_real_attach (XmppXmppStreamModule* base,
                                 XmppXmppStream* stream)
{
	XmppXepJetModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppXepJingleModule* _tmp5_;
	self = (XmppXepJetModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppXepServiceDiscoveryModule*) _tmp1_;
	xmpp_xep_service_discovery_module_add_feature (_tmp2_, stream, XMPP_XEP_JET_NS_URI);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = xmpp_xep_jingle_module_IDENTITY;
	_tmp4_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_JINGLE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (XmppXepJingleModule*) _tmp4_;
	xmpp_xep_jingle_module_register_security_precondition (_tmp5_, (XmppXepJingleSecurityPrecondition*) self);
	_g_object_unref0 (_tmp5_);
}

static void
xmpp_xep_jet_module_real_detach (XmppXmppStreamModule* base,
                                 XmppXmppStream* stream)
{
	XmppXepJetModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	self = (XmppXepJetModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppXepServiceDiscoveryModule*) _tmp1_;
	xmpp_xep_service_discovery_module_remove_feature (_tmp2_, stream, XMPP_XEP_JET_NS_URI);
	_g_object_unref0 (_tmp2_);
}

static void
xmpp_xep_jet_module_is_available_data_free (gpointer _data)
{
	XmppXepJetModuleIsAvailableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->full_jid);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepJetModuleIsAvailableData, _data_);
}

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

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

void
xmpp_xep_jet_module_is_available (XmppXepJetModule* self,
                                  XmppXmppStream* stream,
                                  XmppJid* full_jid,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	XmppXepJetModuleIsAvailableData* _data_;
	XmppXepJetModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (full_jid != NULL);
	_data_ = g_slice_new0 (XmppXepJetModuleIsAvailableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_jet_module_is_available_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (full_jid);
	_xmpp_jid_unref0 (_data_->full_jid);
	_data_->full_jid = _tmp2_;
	xmpp_xep_jet_module_is_available_co (_data_);
}

gboolean
xmpp_xep_jet_module_is_available_finish (XmppXepJetModule* self,
                                         GAsyncResult* _res_)
{
	gboolean result;
	XmppXepJetModuleIsAvailableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
xmpp_xep_jet_module_is_available_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	XmppXepJetModuleIsAvailableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_jet_module_is_available_co (_data_);
}

static gboolean
xmpp_xep_jet_module_is_available_co (XmppXepJetModuleIsAvailableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_data_->_tmp1_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp0_);
	_data_->_tmp2_ = (XmppXepServiceDiscoveryModule*) _data_->_tmp1_;
	_data_->_state_ = 1;
	xmpp_xep_service_discovery_module_has_entity_feature (_data_->_tmp2_, _data_->stream, _data_->full_jid, XMPP_XEP_JET_NS_URI, xmpp_xep_jet_module_is_available_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = xmpp_xep_service_discovery_module_has_entity_feature_finish (_data_->_tmp2_, _data_->_res_);
	_g_object_unref0 (_data_->_tmp2_);
	_data_->result = _data_->_tmp3_;
	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;
}

void
xmpp_xep_jet_module_register_envelop_encoding (XmppXepJetModule* self,
                                               XmppXepJetEnvelopEncoding* encoding)
{
	GeeHashMap* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (encoding != NULL);
	_tmp0_ = self->priv->envelop_encodings;
	_tmp1_ = xmpp_xep_jet_envelop_encoding_get_type_uri (encoding);
	_tmp2_ = _tmp1_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, _tmp2_, encoding);
	_g_free0 (_tmp2_);
}

void
xmpp_xep_jet_module_register_cipher (XmppXepJetModule* self,
                                     XmppXepJetCipher* cipher)
{
	GeeHashMap* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (cipher != NULL);
	_tmp0_ = self->priv->ciphers;
	_tmp1_ = xmpp_xep_jet_cipher_get_cipher_uri (cipher);
	_tmp2_ = _tmp1_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, _tmp2_, cipher);
	_g_free0 (_tmp2_);
}

static gchar*
xmpp_xep_jet_module_real_security_ns_uri (XmppXepJingleSecurityPrecondition* base)
{
	XmppXepJetModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepJetModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_JET_NS_URI);
	result = _tmp0_;
	return result;
}

static XmppXepJingleSecurityParameters*
xmpp_xep_jet_module_real_create_security_parameters (XmppXepJingleSecurityPrecondition* base,
                                                     XmppXmppStream* stream,
                                                     XmppJid* local_full_jid,
                                                     XmppJid* peer_full_jid,
                                                     GObject* options,
                                                     GError** error)
{
	XmppXepJetModule * self;
	XmppXepJetOptions* jet_options = NULL;
	XmppXepJetOptions* _tmp0_;
	gchar* cipher = NULL;
	XmppXepJetOptions* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* type = NULL;
	XmppXepJetOptions* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	gboolean _tmp9_ = FALSE;
	GeeHashMap* _tmp10_;
	const gchar* _tmp11_;
	XmppXepJetEnvelopEncoding* encoding = NULL;
	GeeHashMap* _tmp15_;
	const gchar* _tmp16_;
	gpointer _tmp17_;
	GeeHashMap* _tmp18_;
	const gchar* _tmp19_;
	gpointer _tmp20_;
	XmppXepJetCipher* _tmp21_;
	GeeHashMap* _tmp22_;
	const gchar* _tmp23_;
	gpointer _tmp24_;
	XmppXepJetCipher* _tmp25_;
	XmppXepJetTransportSecret* _tmp26_;
	XmppXepJetTransportSecret* _tmp27_;
	XmppXepJetOptions* _tmp28_;
	XmppXepJetSecurityParameters* _tmp29_;
	XmppXepJingleSecurityParameters* _tmp30_;
	GError* _inner_error0_ = NULL;
	XmppXepJingleSecurityParameters* result;
	self = (XmppXepJetModule*) base;
	g_return_val_if_fail (stream != NULL, NULL);
	g_return_val_if_fail (local_full_jid != NULL, NULL);
	g_return_val_if_fail (peer_full_jid != NULL, NULL);
	g_return_val_if_fail (options != NULL, NULL);
	_vala_return_val_if_fail (XMPP_XEP_JET_IS_OPTIONS (options), "options is Options", NULL);
	_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (options, XMPP_XEP_JET_TYPE_OPTIONS, XmppXepJetOptions));
	jet_options = _tmp0_;
	_tmp1_ = jet_options;
	_tmp2_ = xmpp_xep_jet_options_get_cipher_uri (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strdup (_tmp3_);
	cipher = _tmp4_;
	_tmp5_ = jet_options;
	_tmp6_ = xmpp_xep_jet_options_get_type_uri (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = g_strdup (_tmp7_);
	type = _tmp8_;
	_tmp10_ = self->priv->envelop_encodings;
	_tmp11_ = type;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp10_, _tmp11_)) {
		_tmp9_ = TRUE;
	} else {
		GeeHashMap* _tmp12_;
		const gchar* _tmp13_;
		_tmp12_ = self->priv->ciphers;
		_tmp13_ = cipher;
		_tmp9_ = !gee_abstract_map_has_key ((GeeAbstractMap*) _tmp12_, _tmp13_);
	}
	if (_tmp9_) {
		GError* _tmp14_;
		_tmp14_ = g_error_new_literal (XMPP_XEP_JINGLE_ERROR, XMPP_XEP_JINGLE_ERROR_UNSUPPORTED_SECURITY, "JET cipher or type unknown");
		_inner_error0_ = _tmp14_;
		if (_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (type);
			_g_free0 (cipher);
			_g_object_unref0 (jet_options);
			return NULL;
		} else {
			_g_free0 (type);
			_g_free0 (cipher);
			_g_object_unref0 (jet_options);
			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 NULL;
		}
	}
	_tmp15_ = self->priv->envelop_encodings;
	_tmp16_ = type;
	_tmp17_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp15_, _tmp16_);
	encoding = (XmppXepJetEnvelopEncoding*) _tmp17_;
	_tmp18_ = self->priv->ciphers;
	_tmp19_ = cipher;
	_tmp20_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp18_, _tmp19_);
	_tmp21_ = (XmppXepJetCipher*) _tmp20_;
	_tmp22_ = self->priv->ciphers;
	_tmp23_ = cipher;
	_tmp24_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp22_, _tmp23_);
	_tmp25_ = (XmppXepJetCipher*) _tmp24_;
	_tmp26_ = xmpp_xep_jet_cipher_generate_random_secret (_tmp25_);
	_tmp27_ = _tmp26_;
	_tmp28_ = jet_options;
	_tmp29_ = xmpp_xep_jet_security_parameters_new (_tmp21_, encoding, _tmp27_, _tmp28_);
	_tmp30_ = (XmppXepJingleSecurityParameters*) _tmp29_;
	_xmpp_xep_jet_transport_secret_unref0 (_tmp27_);
	_g_object_unref0 (_tmp25_);
	_g_object_unref0 (_tmp21_);
	result = _tmp30_;
	_g_object_unref0 (encoding);
	_g_free0 (type);
	_g_free0 (cipher);
	_g_object_unref0 (jet_options);
	return result;
}

static XmppXepJingleSecurityParameters*
xmpp_xep_jet_module_real_parse_security_parameters (XmppXepJingleSecurityPrecondition* base,
                                                    XmppXmppStream* stream,
                                                    XmppJid* local_full_jid,
                                                    XmppJid* peer_full_jid,
                                                    XmppStanzaNode* security,
                                                    GError** error)
{
	XmppXepJetModule * self;
	gchar* cipher = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* type = NULL;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	gboolean _tmp8_ = FALSE;
	GeeHashMap* _tmp9_;
	const gchar* _tmp10_;
	XmppXepJetEnvelopEncoding* encoding = NULL;
	GeeHashMap* _tmp14_;
	const gchar* _tmp15_;
	gpointer _tmp16_;
	XmppXepJetTransportSecret* secret = NULL;
	XmppXepJetTransportSecret* _tmp17_;
	GeeHashMap* _tmp18_;
	const gchar* _tmp19_;
	gpointer _tmp20_;
	XmppXepJetCipher* _tmp21_;
	XmppXepJetSecurityParameters* _tmp22_;
	XmppXepJingleSecurityParameters* _tmp23_;
	GError* _inner_error0_ = NULL;
	XmppXepJingleSecurityParameters* result;
	self = (XmppXepJetModule*) base;
	g_return_val_if_fail (stream != NULL, NULL);
	g_return_val_if_fail (local_full_jid != NULL, NULL);
	g_return_val_if_fail (peer_full_jid != NULL, NULL);
	g_return_val_if_fail (security != NULL, NULL);
	_tmp0_ = xmpp_stanza_node_get_attribute (security, "cipher", NULL);
	_tmp1_ = g_strdup (_tmp0_);
	cipher = _tmp1_;
	_tmp2_ = xmpp_stanza_node_get_attribute (security, "type", NULL);
	_tmp3_ = g_strdup (_tmp2_);
	type = _tmp3_;
	_tmp5_ = cipher;
	if (_tmp5_ == NULL) {
		_tmp4_ = TRUE;
	} else {
		const gchar* _tmp6_;
		_tmp6_ = type;
		_tmp4_ = _tmp6_ == NULL;
	}
	if (_tmp4_) {
		GError* _tmp7_;
		_tmp7_ = g_error_new_literal (XMPP_XEP_JINGLE_IQ_ERROR, XMPP_XEP_JINGLE_IQ_ERROR_BAD_REQUEST, "No cipher or type specified for JET");
		_inner_error0_ = _tmp7_;
		if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (type);
			_g_free0 (cipher);
			return NULL;
		} else {
			_g_free0 (type);
			_g_free0 (cipher);
			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 NULL;
		}
	}
	_tmp9_ = self->priv->envelop_encodings;
	_tmp10_ = type;
	if (!gee_abstract_map_has_key ((GeeAbstractMap*) _tmp9_, _tmp10_)) {
		_tmp8_ = TRUE;
	} else {
		GeeHashMap* _tmp11_;
		const gchar* _tmp12_;
		_tmp11_ = self->priv->ciphers;
		_tmp12_ = cipher;
		_tmp8_ = !gee_abstract_map_has_key ((GeeAbstractMap*) _tmp11_, _tmp12_);
	}
	if (_tmp8_) {
		GError* _tmp13_;
		_tmp13_ = g_error_new_literal (XMPP_XEP_JINGLE_IQ_ERROR, XMPP_XEP_JINGLE_IQ_ERROR_NOT_IMPLEMENTED, "JET cipher or type unknown");
		_inner_error0_ = _tmp13_;
		if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (type);
			_g_free0 (cipher);
			return NULL;
		} else {
			_g_free0 (type);
			_g_free0 (cipher);
			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 NULL;
		}
	}
	_tmp14_ = self->priv->envelop_encodings;
	_tmp15_ = type;
	_tmp16_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp14_, _tmp15_);
	encoding = (XmppXepJetEnvelopEncoding*) _tmp16_;
	_tmp17_ = xmpp_xep_jet_envelop_encoding_decode_envolop (encoding, stream, local_full_jid, peer_full_jid, security, &_inner_error0_);
	secret = _tmp17_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (encoding);
			_g_free0 (type);
			_g_free0 (cipher);
			return NULL;
		} else {
			_g_object_unref0 (encoding);
			_g_free0 (type);
			_g_free0 (cipher);
			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 NULL;
		}
	}
	_tmp18_ = self->priv->ciphers;
	_tmp19_ = cipher;
	_tmp20_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp18_, _tmp19_);
	_tmp21_ = (XmppXepJetCipher*) _tmp20_;
	_tmp22_ = xmpp_xep_jet_security_parameters_new (_tmp21_, encoding, secret, NULL);
	_tmp23_ = (XmppXepJingleSecurityParameters*) _tmp22_;
	_g_object_unref0 (_tmp21_);
	result = _tmp23_;
	_xmpp_xep_jet_transport_secret_unref0 (secret);
	_g_object_unref0 (encoding);
	_g_free0 (type);
	_g_free0 (cipher);
	return result;
}

static gchar*
xmpp_xep_jet_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepJetModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepJetModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_JET_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_jet_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepJetModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepJetModule*) base;
	_tmp0_ = xmpp_xep_jet_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepJetModule*
xmpp_xep_jet_module_construct (GType object_type)
{
	XmppXepJetModule * self = NULL;
	self = (XmppXepJetModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepJetModule*
xmpp_xep_jet_module_new (void)
{
	return xmpp_xep_jet_module_construct (XMPP_XEP_JET_TYPE_MODULE);
}

static void
xmpp_xep_jet_module_class_init (XmppXepJetModuleClass * klass,
                                gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_jet_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJetModule_private_offset);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_jet_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_jet_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_jet_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_jet_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jet_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_JET_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_JET_NS_URI, "0391_jet");
	xmpp_xep_jet_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_jet_module_xmpp_xep_jingle_security_precondition_interface_init (XmppXepJingleSecurityPreconditionIface * iface,
                                                                          gpointer iface_data)
{
	xmpp_xep_jet_module_xmpp_xep_jingle_security_precondition_parent_iface = g_type_interface_peek_parent (iface);
	iface->security_ns_uri = (gchar* (*) (XmppXepJingleSecurityPrecondition*)) xmpp_xep_jet_module_real_security_ns_uri;
	iface->create_security_parameters = (XmppXepJingleSecurityParameters* (*) (XmppXepJingleSecurityPrecondition*, XmppXmppStream*, XmppJid*, XmppJid*, GObject*, GError**)) xmpp_xep_jet_module_real_create_security_parameters;
	iface->parse_security_parameters = (XmppXepJingleSecurityParameters* (*) (XmppXepJingleSecurityPrecondition*, XmppXmppStream*, XmppJid*, XmppJid*, XmppStanzaNode*, GError**)) xmpp_xep_jet_module_real_parse_security_parameters;
}

static void
xmpp_xep_jet_module_instance_init (XmppXepJetModule * self,
                                   gpointer klass)
{
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	self->priv = xmpp_xep_jet_module_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, XMPP_XEP_JET_TYPE_ENVELOP_ENCODING, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->envelop_encodings = _tmp0_;
	_tmp1_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, XMPP_XEP_JET_TYPE_CIPHER, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->ciphers = _tmp1_;
}

static void
xmpp_xep_jet_module_finalize (GObject * obj)
{
	XmppXepJetModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JET_TYPE_MODULE, XmppXepJetModule);
	_g_object_unref0 (self->priv->envelop_encodings);
	_g_object_unref0 (self->priv->ciphers);
	G_OBJECT_CLASS (xmpp_xep_jet_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jet_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJetModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jet_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJetModule), 0, (GInstanceInitFunc) xmpp_xep_jet_module_instance_init, NULL };
	static const GInterfaceInfo xmpp_xep_jingle_security_precondition_info = { (GInterfaceInitFunc) xmpp_xep_jet_module_xmpp_xep_jingle_security_precondition_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType xmpp_xep_jet_module_type_id;
	xmpp_xep_jet_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepJetModule", &g_define_type_info, 0);
	g_type_add_interface_static (xmpp_xep_jet_module_type_id, XMPP_XEP_JINGLE_TYPE_SECURITY_PRECONDITION, &xmpp_xep_jingle_security_precondition_info);
	XmppXepJetModule_private_offset = g_type_add_instance_private (xmpp_xep_jet_module_type_id, sizeof (XmppXepJetModulePrivate));
	return xmpp_xep_jet_module_type_id;
}

GType
xmpp_xep_jet_module_get_type (void)
{
	static volatile gsize xmpp_xep_jet_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jet_module_type_id__once)) {
		GType xmpp_xep_jet_module_type_id;
		xmpp_xep_jet_module_type_id = xmpp_xep_jet_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_jet_module_type_id__once, xmpp_xep_jet_module_type_id);
	}
	return xmpp_xep_jet_module_type_id__once;
}

static inline gpointer
xmpp_xep_jet_options_get_instance_private (XmppXepJetOptions* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJetOptions_private_offset);
}

XmppXepJetOptions*
xmpp_xep_jet_options_construct (GType object_type,
                                const gchar* type_uri,
                                const gchar* cipher_uri)
{
	XmppXepJetOptions * self = NULL;
	g_return_val_if_fail (type_uri != NULL, NULL);
	g_return_val_if_fail (cipher_uri != NULL, NULL);
	self = (XmppXepJetOptions*) g_object_new (object_type, NULL);
	xmpp_xep_jet_options_set_type_uri (self, type_uri);
	xmpp_xep_jet_options_set_cipher_uri (self, cipher_uri);
	return self;
}

XmppXepJetOptions*
xmpp_xep_jet_options_new (const gchar* type_uri,
                          const gchar* cipher_uri)
{
	return xmpp_xep_jet_options_construct (XMPP_XEP_JET_TYPE_OPTIONS, type_uri, cipher_uri);
}

const gchar*
xmpp_xep_jet_options_get_type_uri (XmppXepJetOptions* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_type_uri;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jet_options_set_type_uri (XmppXepJetOptions* self,
                                   const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jet_options_get_type_uri (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_type_uri);
		self->priv->_type_uri = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jet_options_properties[XMPP_XEP_JET_OPTIONS_TYPE_URI_PROPERTY]);
	}
}

const gchar*
xmpp_xep_jet_options_get_cipher_uri (XmppXepJetOptions* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_cipher_uri;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jet_options_set_cipher_uri (XmppXepJetOptions* self,
                                     const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jet_options_get_cipher_uri (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_cipher_uri);
		self->priv->_cipher_uri = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jet_options_properties[XMPP_XEP_JET_OPTIONS_CIPHER_URI_PROPERTY]);
	}
}

static void
xmpp_xep_jet_options_class_init (XmppXepJetOptionsClass * klass,
                                 gpointer klass_data)
{
	xmpp_xep_jet_options_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJetOptions_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_jet_options_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_jet_options_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jet_options_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_OPTIONS_TYPE_URI_PROPERTY, xmpp_xep_jet_options_properties[XMPP_XEP_JET_OPTIONS_TYPE_URI_PROPERTY] = g_param_spec_string ("type-uri", "type-uri", "type-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_OPTIONS_CIPHER_URI_PROPERTY, xmpp_xep_jet_options_properties[XMPP_XEP_JET_OPTIONS_CIPHER_URI_PROPERTY] = g_param_spec_string ("cipher-uri", "cipher-uri", "cipher-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_jet_options_instance_init (XmppXepJetOptions * self,
                                    gpointer klass)
{
	self->priv = xmpp_xep_jet_options_get_instance_private (self);
}

static void
xmpp_xep_jet_options_finalize (GObject * obj)
{
	XmppXepJetOptions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JET_TYPE_OPTIONS, XmppXepJetOptions);
	_g_free0 (self->priv->_type_uri);
	_g_free0 (self->priv->_cipher_uri);
	G_OBJECT_CLASS (xmpp_xep_jet_options_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jet_options_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJetOptionsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jet_options_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJetOptions), 0, (GInstanceInitFunc) xmpp_xep_jet_options_instance_init, NULL };
	GType xmpp_xep_jet_options_type_id;
	xmpp_xep_jet_options_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepJetOptions", &g_define_type_info, 0);
	XmppXepJetOptions_private_offset = g_type_add_instance_private (xmpp_xep_jet_options_type_id, sizeof (XmppXepJetOptionsPrivate));
	return xmpp_xep_jet_options_type_id;
}

GType
xmpp_xep_jet_options_get_type (void)
{
	static volatile gsize xmpp_xep_jet_options_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jet_options_type_id__once)) {
		GType xmpp_xep_jet_options_type_id;
		xmpp_xep_jet_options_type_id = xmpp_xep_jet_options_get_type_once ();
		g_once_init_leave (&xmpp_xep_jet_options_type_id__once, xmpp_xep_jet_options_type_id);
	}
	return xmpp_xep_jet_options_type_id__once;
}

static void
_vala_xmpp_xep_jet_options_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec)
{
	XmppXepJetOptions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JET_TYPE_OPTIONS, XmppXepJetOptions);
	switch (property_id) {
		case XMPP_XEP_JET_OPTIONS_TYPE_URI_PROPERTY:
		g_value_set_string (value, xmpp_xep_jet_options_get_type_uri (self));
		break;
		case XMPP_XEP_JET_OPTIONS_CIPHER_URI_PROPERTY:
		g_value_set_string (value, xmpp_xep_jet_options_get_cipher_uri (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_jet_options_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec)
{
	XmppXepJetOptions * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JET_TYPE_OPTIONS, XmppXepJetOptions);
	switch (property_id) {
		case XMPP_XEP_JET_OPTIONS_TYPE_URI_PROPERTY:
		xmpp_xep_jet_options_set_type_uri (self, g_value_get_string (value));
		break;
		case XMPP_XEP_JET_OPTIONS_CIPHER_URI_PROPERTY:
		xmpp_xep_jet_options_set_cipher_uri (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
xmpp_xep_jet_security_parameters_get_instance_private (XmppXepJetSecurityParameters* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJetSecurityParameters_private_offset);
}

XmppXepJetSecurityParameters*
xmpp_xep_jet_security_parameters_construct (GType object_type,
                                            XmppXepJetCipher* cipher,
                                            XmppXepJetEnvelopEncoding* encoding,
                                            XmppXepJetTransportSecret* secret,
                                            XmppXepJetOptions* options)
{
	XmppXepJetSecurityParameters * self = NULL;
	g_return_val_if_fail (cipher != NULL, NULL);
	g_return_val_if_fail (encoding != NULL, NULL);
	g_return_val_if_fail (secret != NULL, NULL);
	self = (XmppXepJetSecurityParameters*) g_object_new (object_type, NULL);
	xmpp_xep_jet_security_parameters_set_cipher (self, cipher);
	xmpp_xep_jet_security_parameters_set_encoding (self, encoding);
	xmpp_xep_jet_security_parameters_set_secret (self, secret);
	xmpp_xep_jet_security_parameters_set_options (self, options);
	return self;
}

XmppXepJetSecurityParameters*
xmpp_xep_jet_security_parameters_new (XmppXepJetCipher* cipher,
                                      XmppXepJetEnvelopEncoding* encoding,
                                      XmppXepJetTransportSecret* secret,
                                      XmppXepJetOptions* options)
{
	return xmpp_xep_jet_security_parameters_construct (XMPP_XEP_JET_TYPE_SECURITY_PARAMETERS, cipher, encoding, secret, options);
}

static gchar*
xmpp_xep_jet_security_parameters_real_security_ns_uri (XmppXepJingleSecurityParameters* base)
{
	XmppXepJetSecurityParameters * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepJetSecurityParameters*) base;
	_tmp0_ = g_strdup (XMPP_XEP_JET_NS_URI);
	result = _tmp0_;
	return result;
}

static GIOStream*
xmpp_xep_jet_security_parameters_real_wrap_stream (XmppXepJingleSecurityParameters* base,
                                                   GIOStream* stream)
{
	XmppXepJetSecurityParameters * self;
	XmppXepJetEnvelopEncoding* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	XmppXepJetCipher* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	XmppXepJetCipher* _tmp6_;
	XmppXepJetTransportSecret* _tmp7_;
	XmppXepJetEncryptedStream* _tmp8_;
	GIOStream* result;
	self = (XmppXepJetSecurityParameters*) base;
	g_return_val_if_fail (stream != NULL, NULL);
	_tmp0_ = self->priv->_encoding;
	_tmp1_ = xmpp_xep_jet_envelop_encoding_get_type_uri (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->_cipher;
	_tmp4_ = xmpp_xep_jet_cipher_get_cipher_uri (_tmp3_);
	_tmp5_ = _tmp4_;
	g_debug ("0391_jingle_encrypted_transports.vala:93: Wrapping stream into encrypt" \
"ed stream for %s/%s", _tmp2_, _tmp5_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	_tmp6_ = self->priv->_cipher;
	_tmp7_ = self->priv->_secret;
	_tmp8_ = xmpp_xep_jet_encrypted_stream_new (_tmp6_, _tmp7_, stream);
	result = (GIOStream*) _tmp8_;
	return result;
}

static XmppStanzaNode*
xmpp_xep_jet_security_parameters_real_to_security_stanza_node (XmppXepJingleSecurityParameters* base,
                                                               XmppXmppStream* stream,
                                                               XmppJid* local_full_jid,
                                                               XmppJid* peer_full_jid)
{
	XmppXepJetSecurityParameters * self;
	XmppStanzaNode* security = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	XmppStanzaNode* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppXepJetCipher* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	XmppStanzaNode* _tmp7_;
	XmppStanzaNode* _tmp8_;
	XmppXepJetEnvelopEncoding* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	XmppStanzaNode* _tmp12_;
	XmppStanzaNode* _tmp13_;
	XmppXepJetEnvelopEncoding* _tmp14_;
	XmppStanzaNode* result;
	self = (XmppXepJetSecurityParameters*) base;
	g_return_val_if_fail (stream != NULL, NULL);
	g_return_val_if_fail (local_full_jid != NULL, NULL);
	g_return_val_if_fail (peer_full_jid != NULL, NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("security", XMPP_XEP_JET_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_stanza_node_add_self_xmlns (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = self->priv->_cipher;
	_tmp5_ = xmpp_xep_jet_cipher_get_cipher_uri (_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp7_ = xmpp_stanza_node_put_attribute (_tmp3_, "cipher", _tmp6_, NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = self->priv->_encoding;
	_tmp10_ = xmpp_xep_jet_envelop_encoding_get_type_uri (_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp12_ = xmpp_stanza_node_put_attribute (_tmp8_, "type", _tmp11_, NULL);
	_tmp13_ = _tmp12_;
	_g_free0 (_tmp11_);
	_xmpp_stanza_entry_unref0 (_tmp8_);
	_g_free0 (_tmp6_);
	_xmpp_stanza_entry_unref0 (_tmp3_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	security = _tmp13_;
	_tmp14_ = self->priv->_encoding;
	xmpp_xep_jet_envelop_encoding_encode_envelop (_tmp14_, stream, local_full_jid, peer_full_jid, self, security);
	result = security;
	return result;
}

XmppXepJetCipher*
xmpp_xep_jet_security_parameters_get_cipher (XmppXepJetSecurityParameters* self)
{
	XmppXepJetCipher* result;
	XmppXepJetCipher* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_cipher;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jet_security_parameters_set_cipher (XmppXepJetSecurityParameters* self,
                                             XmppXepJetCipher* value)
{
	XmppXepJetCipher* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jet_security_parameters_get_cipher (self);
	if (old_value != value) {
		XmppXepJetCipher* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_cipher);
		self->priv->_cipher = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_CIPHER_PROPERTY]);
	}
}

XmppXepJetEnvelopEncoding*
xmpp_xep_jet_security_parameters_get_encoding (XmppXepJetSecurityParameters* self)
{
	XmppXepJetEnvelopEncoding* result;
	XmppXepJetEnvelopEncoding* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_encoding;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jet_security_parameters_set_encoding (XmppXepJetSecurityParameters* self,
                                               XmppXepJetEnvelopEncoding* value)
{
	XmppXepJetEnvelopEncoding* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jet_security_parameters_get_encoding (self);
	if (old_value != value) {
		XmppXepJetEnvelopEncoding* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_encoding);
		self->priv->_encoding = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_ENCODING_PROPERTY]);
	}
}

XmppXepJetTransportSecret*
xmpp_xep_jet_security_parameters_get_secret (XmppXepJetSecurityParameters* self)
{
	XmppXepJetTransportSecret* result;
	XmppXepJetTransportSecret* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_secret;
	result = _tmp0_;
	return result;
}

static gpointer
_xmpp_xep_jet_transport_secret_ref0 (gpointer self)
{
	return self ? xmpp_xep_jet_transport_secret_ref (self) : NULL;
}

static void
xmpp_xep_jet_security_parameters_set_secret (XmppXepJetSecurityParameters* self,
                                             XmppXepJetTransportSecret* value)
{
	XmppXepJetTransportSecret* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jet_security_parameters_get_secret (self);
	if (old_value != value) {
		XmppXepJetTransportSecret* _tmp0_;
		_tmp0_ = _xmpp_xep_jet_transport_secret_ref0 (value);
		_xmpp_xep_jet_transport_secret_unref0 (self->priv->_secret);
		self->priv->_secret = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_SECRET_PROPERTY]);
	}
}

XmppXepJetOptions*
xmpp_xep_jet_security_parameters_get_options (XmppXepJetSecurityParameters* self)
{
	XmppXepJetOptions* result;
	XmppXepJetOptions* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_options;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jet_security_parameters_set_options (XmppXepJetSecurityParameters* self,
                                              XmppXepJetOptions* value)
{
	XmppXepJetOptions* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jet_security_parameters_get_options (self);
	if (old_value != value) {
		XmppXepJetOptions* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_options);
		self->priv->_options = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_OPTIONS_PROPERTY]);
	}
}

static void
xmpp_xep_jet_security_parameters_class_init (XmppXepJetSecurityParametersClass * klass,
                                             gpointer klass_data)
{
	xmpp_xep_jet_security_parameters_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJetSecurityParameters_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_jet_security_parameters_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_jet_security_parameters_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jet_security_parameters_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_SECURITY_PARAMETERS_CIPHER_PROPERTY, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_CIPHER_PROPERTY] = g_param_spec_object ("cipher", "cipher", "cipher", XMPP_XEP_JET_TYPE_CIPHER, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_SECURITY_PARAMETERS_ENCODING_PROPERTY, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_ENCODING_PROPERTY] = g_param_spec_object ("encoding", "encoding", "encoding", XMPP_XEP_JET_TYPE_ENVELOP_ENCODING, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_SECURITY_PARAMETERS_SECRET_PROPERTY, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_SECRET_PROPERTY] = xmpp_xep_jet_param_spec_transport_secret ("secret", "secret", "secret", XMPP_XEP_JET_TYPE_TRANSPORT_SECRET, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_SECURITY_PARAMETERS_OPTIONS_PROPERTY, xmpp_xep_jet_security_parameters_properties[XMPP_XEP_JET_SECURITY_PARAMETERS_OPTIONS_PROPERTY] = g_param_spec_object ("options", "options", "options", XMPP_XEP_JET_TYPE_OPTIONS, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_jet_security_parameters_xmpp_xep_jingle_security_parameters_interface_init (XmppXepJingleSecurityParametersIface * iface,
                                                                                     gpointer iface_data)
{
	xmpp_xep_jet_security_parameters_xmpp_xep_jingle_security_parameters_parent_iface = g_type_interface_peek_parent (iface);
	iface->security_ns_uri = (gchar* (*) (XmppXepJingleSecurityParameters*)) xmpp_xep_jet_security_parameters_real_security_ns_uri;
	iface->wrap_stream = (GIOStream* (*) (XmppXepJingleSecurityParameters*, GIOStream*)) xmpp_xep_jet_security_parameters_real_wrap_stream;
	iface->to_security_stanza_node = (XmppStanzaNode* (*) (XmppXepJingleSecurityParameters*, XmppXmppStream*, XmppJid*, XmppJid*)) xmpp_xep_jet_security_parameters_real_to_security_stanza_node;
}

static void
xmpp_xep_jet_security_parameters_instance_init (XmppXepJetSecurityParameters * self,
                                                gpointer klass)
{
	self->priv = xmpp_xep_jet_security_parameters_get_instance_private (self);
}

static void
xmpp_xep_jet_security_parameters_finalize (GObject * obj)
{
	XmppXepJetSecurityParameters * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JET_TYPE_SECURITY_PARAMETERS, XmppXepJetSecurityParameters);
	_g_object_unref0 (self->priv->_cipher);
	_g_object_unref0 (self->priv->_encoding);
	_xmpp_xep_jet_transport_secret_unref0 (self->priv->_secret);
	_g_object_unref0 (self->priv->_options);
	G_OBJECT_CLASS (xmpp_xep_jet_security_parameters_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jet_security_parameters_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJetSecurityParametersClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jet_security_parameters_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJetSecurityParameters), 0, (GInstanceInitFunc) xmpp_xep_jet_security_parameters_instance_init, NULL };
	static const GInterfaceInfo xmpp_xep_jingle_security_parameters_info = { (GInterfaceInitFunc) xmpp_xep_jet_security_parameters_xmpp_xep_jingle_security_parameters_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType xmpp_xep_jet_security_parameters_type_id;
	xmpp_xep_jet_security_parameters_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepJetSecurityParameters", &g_define_type_info, 0);
	g_type_add_interface_static (xmpp_xep_jet_security_parameters_type_id, XMPP_XEP_JINGLE_TYPE_SECURITY_PARAMETERS, &xmpp_xep_jingle_security_parameters_info);
	XmppXepJetSecurityParameters_private_offset = g_type_add_instance_private (xmpp_xep_jet_security_parameters_type_id, sizeof (XmppXepJetSecurityParametersPrivate));
	return xmpp_xep_jet_security_parameters_type_id;
}

GType
xmpp_xep_jet_security_parameters_get_type (void)
{
	static volatile gsize xmpp_xep_jet_security_parameters_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jet_security_parameters_type_id__once)) {
		GType xmpp_xep_jet_security_parameters_type_id;
		xmpp_xep_jet_security_parameters_type_id = xmpp_xep_jet_security_parameters_get_type_once ();
		g_once_init_leave (&xmpp_xep_jet_security_parameters_type_id__once, xmpp_xep_jet_security_parameters_type_id);
	}
	return xmpp_xep_jet_security_parameters_type_id__once;
}

static void
_vala_xmpp_xep_jet_security_parameters_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	XmppXepJetSecurityParameters * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JET_TYPE_SECURITY_PARAMETERS, XmppXepJetSecurityParameters);
	switch (property_id) {
		case XMPP_XEP_JET_SECURITY_PARAMETERS_CIPHER_PROPERTY:
		g_value_set_object (value, xmpp_xep_jet_security_parameters_get_cipher (self));
		break;
		case XMPP_XEP_JET_SECURITY_PARAMETERS_ENCODING_PROPERTY:
		g_value_set_object (value, xmpp_xep_jet_security_parameters_get_encoding (self));
		break;
		case XMPP_XEP_JET_SECURITY_PARAMETERS_SECRET_PROPERTY:
		xmpp_xep_jet_value_set_transport_secret (value, xmpp_xep_jet_security_parameters_get_secret (self));
		break;
		case XMPP_XEP_JET_SECURITY_PARAMETERS_OPTIONS_PROPERTY:
		g_value_set_object (value, xmpp_xep_jet_security_parameters_get_options (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_jet_security_parameters_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	XmppXepJetSecurityParameters * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JET_TYPE_SECURITY_PARAMETERS, XmppXepJetSecurityParameters);
	switch (property_id) {
		case XMPP_XEP_JET_SECURITY_PARAMETERS_CIPHER_PROPERTY:
		xmpp_xep_jet_security_parameters_set_cipher (self, g_value_get_object (value));
		break;
		case XMPP_XEP_JET_SECURITY_PARAMETERS_ENCODING_PROPERTY:
		xmpp_xep_jet_security_parameters_set_encoding (self, g_value_get_object (value));
		break;
		case XMPP_XEP_JET_SECURITY_PARAMETERS_SECRET_PROPERTY:
		xmpp_xep_jet_security_parameters_set_secret (self, xmpp_xep_jet_value_get_transport_secret (value));
		break;
		case XMPP_XEP_JET_SECURITY_PARAMETERS_OPTIONS_PROPERTY:
		xmpp_xep_jet_security_parameters_set_options (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

gchar*
xmpp_xep_jet_cipher_get_cipher_uri (XmppXepJetCipher* self)
{
	XmppXepJetCipherIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_JET_CIPHER_GET_INTERFACE (self);
	if (_iface_->get_cipher_uri) {
		return _iface_->get_cipher_uri (self);
	}
	return NULL;
}

XmppXepJetTransportSecret*
xmpp_xep_jet_cipher_generate_random_secret (XmppXepJetCipher* self)
{
	XmppXepJetCipherIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_JET_CIPHER_GET_INTERFACE (self);
	if (_iface_->generate_random_secret) {
		return _iface_->generate_random_secret (self);
	}
	return NULL;
}

GInputStream*
xmpp_xep_jet_cipher_wrap_input_stream (XmppXepJetCipher* self,
                                       GInputStream* input,
                                       XmppXepJetTransportSecret* secret)
{
	XmppXepJetCipherIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_JET_CIPHER_GET_INTERFACE (self);
	if (_iface_->wrap_input_stream) {
		return _iface_->wrap_input_stream (self, input, secret);
	}
	return NULL;
}

GOutputStream*
xmpp_xep_jet_cipher_wrap_output_stream (XmppXepJetCipher* self,
                                        GOutputStream* output,
                                        XmppXepJetTransportSecret* secret)
{
	XmppXepJetCipherIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_JET_CIPHER_GET_INTERFACE (self);
	if (_iface_->wrap_output_stream) {
		return _iface_->wrap_output_stream (self, output, secret);
	}
	return NULL;
}

static void
xmpp_xep_jet_cipher_default_init (XmppXepJetCipherIface * iface,
                                  gpointer iface_data)
{
}

static GType
xmpp_xep_jet_cipher_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJetCipherIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jet_cipher_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType xmpp_xep_jet_cipher_type_id;
	xmpp_xep_jet_cipher_type_id = g_type_register_static (G_TYPE_INTERFACE, "XmppXepJetCipher", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (xmpp_xep_jet_cipher_type_id, G_TYPE_OBJECT);
	return xmpp_xep_jet_cipher_type_id;
}

GType
xmpp_xep_jet_cipher_get_type (void)
{
	static volatile gsize xmpp_xep_jet_cipher_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jet_cipher_type_id__once)) {
		GType xmpp_xep_jet_cipher_type_id;
		xmpp_xep_jet_cipher_type_id = xmpp_xep_jet_cipher_get_type_once ();
		g_once_init_leave (&xmpp_xep_jet_cipher_type_id__once, xmpp_xep_jet_cipher_type_id);
	}
	return xmpp_xep_jet_cipher_type_id__once;
}

static inline gpointer
xmpp_xep_jet_encrypted_stream_get_instance_private (XmppXepJetEncryptedStream* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJetEncryptedStream_private_offset);
}

XmppXepJetEncryptedStream*
xmpp_xep_jet_encrypted_stream_construct (GType object_type,
                                         XmppXepJetCipher* cipher,
                                         XmppXepJetTransportSecret* secret,
                                         GIOStream* stream)
{
	XmppXepJetEncryptedStream * self = NULL;
	GIOStream* _tmp0_;
	GInputStream* _tmp1_;
	GInputStream* _tmp2_;
	GInputStream* _tmp3_;
	GOutputStream* _tmp4_;
	GOutputStream* _tmp5_;
	GOutputStream* _tmp6_;
	g_return_val_if_fail (cipher != NULL, NULL);
	g_return_val_if_fail (secret != NULL, NULL);
	g_return_val_if_fail (stream != NULL, NULL);
	self = (XmppXepJetEncryptedStream*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (stream);
	_g_object_unref0 (self->priv->stream);
	self->priv->stream = _tmp0_;
	_tmp1_ = g_io_stream_get_input_stream (stream);
	_tmp2_ = _tmp1_;
	_tmp3_ = xmpp_xep_jet_cipher_wrap_input_stream (cipher, _tmp2_, secret);
	_g_object_unref0 (self->priv->input);
	self->priv->input = _tmp3_;
	_tmp4_ = g_io_stream_get_output_stream (stream);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_xep_jet_cipher_wrap_output_stream (cipher, _tmp5_, secret);
	_g_object_unref0 (self->priv->output);
	self->priv->output = _tmp6_;
	return self;
}

XmppXepJetEncryptedStream*
xmpp_xep_jet_encrypted_stream_new (XmppXepJetCipher* cipher,
                                   XmppXepJetTransportSecret* secret,
                                   GIOStream* stream)
{
	return xmpp_xep_jet_encrypted_stream_construct (XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM, cipher, secret, stream);
}

static GInputStream*
xmpp_xep_jet_encrypted_stream_real_get_input_stream (GIOStream* base)
{
	GInputStream* result;
	XmppXepJetEncryptedStream* self;
	GInputStream* _tmp0_;
	self = (XmppXepJetEncryptedStream*) base;
	_tmp0_ = self->priv->input;
	result = _tmp0_;
	return result;
}

static GOutputStream*
xmpp_xep_jet_encrypted_stream_real_get_output_stream (GIOStream* base)
{
	GOutputStream* result;
	XmppXepJetEncryptedStream* self;
	GOutputStream* _tmp0_;
	self = (XmppXepJetEncryptedStream*) base;
	_tmp0_ = self->priv->output;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jet_encrypted_stream_class_init (XmppXepJetEncryptedStreamClass * klass,
                                          gpointer klass_data)
{
	xmpp_xep_jet_encrypted_stream_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJetEncryptedStream_private_offset);
	G_IO_STREAM_CLASS (klass)->get_input_stream = (GInputStream* (*) (GIOStream*)) xmpp_xep_jet_encrypted_stream_real_get_input_stream;
	G_IO_STREAM_CLASS (klass)->get_output_stream = (GOutputStream* (*) (GIOStream*)) xmpp_xep_jet_encrypted_stream_real_get_output_stream;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_jet_encrypted_stream_get_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jet_encrypted_stream_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_ENCRYPTED_STREAM_INPUT_STREAM_PROPERTY, xmpp_xep_jet_encrypted_stream_properties[XMPP_XEP_JET_ENCRYPTED_STREAM_INPUT_STREAM_PROPERTY] = g_param_spec_object ("input-stream", "input-stream", "input-stream", g_input_stream_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JET_ENCRYPTED_STREAM_OUTPUT_STREAM_PROPERTY, xmpp_xep_jet_encrypted_stream_properties[XMPP_XEP_JET_ENCRYPTED_STREAM_OUTPUT_STREAM_PROPERTY] = g_param_spec_object ("output-stream", "output-stream", "output-stream", g_output_stream_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_jet_encrypted_stream_instance_init (XmppXepJetEncryptedStream * self,
                                             gpointer klass)
{
	self->priv = xmpp_xep_jet_encrypted_stream_get_instance_private (self);
}

static void
xmpp_xep_jet_encrypted_stream_finalize (GObject * obj)
{
	XmppXepJetEncryptedStream * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM, XmppXepJetEncryptedStream);
	_g_object_unref0 (self->priv->stream);
	_g_object_unref0 (self->priv->input);
	_g_object_unref0 (self->priv->output);
	G_OBJECT_CLASS (xmpp_xep_jet_encrypted_stream_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jet_encrypted_stream_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJetEncryptedStreamClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jet_encrypted_stream_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJetEncryptedStream), 0, (GInstanceInitFunc) xmpp_xep_jet_encrypted_stream_instance_init, NULL };
	GType xmpp_xep_jet_encrypted_stream_type_id;
	xmpp_xep_jet_encrypted_stream_type_id = g_type_register_static (g_io_stream_get_type (), "XmppXepJetEncryptedStream", &g_define_type_info, 0);
	XmppXepJetEncryptedStream_private_offset = g_type_add_instance_private (xmpp_xep_jet_encrypted_stream_type_id, sizeof (XmppXepJetEncryptedStreamPrivate));
	return xmpp_xep_jet_encrypted_stream_type_id;
}

GType
xmpp_xep_jet_encrypted_stream_get_type (void)
{
	static volatile gsize xmpp_xep_jet_encrypted_stream_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jet_encrypted_stream_type_id__once)) {
		GType xmpp_xep_jet_encrypted_stream_type_id;
		xmpp_xep_jet_encrypted_stream_type_id = xmpp_xep_jet_encrypted_stream_get_type_once ();
		g_once_init_leave (&xmpp_xep_jet_encrypted_stream_type_id__once, xmpp_xep_jet_encrypted_stream_type_id);
	}
	return xmpp_xep_jet_encrypted_stream_type_id__once;
}

static void
_vala_xmpp_xep_jet_encrypted_stream_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	XmppXepJetEncryptedStream * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JET_TYPE_ENCRYPTED_STREAM, XmppXepJetEncryptedStream);
	switch (property_id) {
		case XMPP_XEP_JET_ENCRYPTED_STREAM_INPUT_STREAM_PROPERTY:
		g_value_set_object (value, g_io_stream_get_input_stream ((GIOStream*) self));
		break;
		case XMPP_XEP_JET_ENCRYPTED_STREAM_OUTPUT_STREAM_PROPERTY:
		g_value_set_object (value, g_io_stream_get_output_stream ((GIOStream*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
xmpp_xep_jet_transport_secret_get_instance_private (XmppXepJetTransportSecret* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJetTransportSecret_private_offset);
}

XmppXepJetTransportSecret*
xmpp_xep_jet_transport_secret_construct (GType object_type,
                                         guint8* transport_key,
                                         gint transport_key_length1,
                                         guint8* initialization_vector,
                                         gint initialization_vector_length1)
{
	XmppXepJetTransportSecret* self = NULL;
	self = (XmppXepJetTransportSecret*) g_type_create_instance (object_type);
	xmpp_xep_jet_transport_secret_set_transport_key (self, transport_key, transport_key_length1);
	xmpp_xep_jet_transport_secret_set_initialization_vector (self, initialization_vector, initialization_vector_length1);
	return self;
}

XmppXepJetTransportSecret*
xmpp_xep_jet_transport_secret_new (guint8* transport_key,
                                   gint transport_key_length1,
                                   guint8* initialization_vector,
                                   gint initialization_vector_length1)
{
	return xmpp_xep_jet_transport_secret_construct (XMPP_XEP_JET_TYPE_TRANSPORT_SECRET, transport_key, transport_key_length1, initialization_vector, initialization_vector_length1);
}

guint8*
xmpp_xep_jet_transport_secret_get_transport_key (XmppXepJetTransportSecret* self,
                                                 gint* result_length1)
{
	guint8* result;
	guint8* _tmp0_;
	gint _tmp0__length1;
	guint8* _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_transport_key;
	_tmp0__length1 = self->priv->_transport_key_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

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

static void
xmpp_xep_jet_transport_secret_set_transport_key (XmppXepJetTransportSecret* self,
                                                 guint8* value,
                                                 gint value_length1)
{
	guint8* _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = (value != NULL) ? _vala_array_dup13 (value, value_length1) : value;
	_tmp0__length1 = value_length1;
	self->priv->_transport_key = (g_free (self->priv->_transport_key), NULL);
	self->priv->_transport_key = _tmp0_;
	self->priv->_transport_key_length1 = _tmp0__length1;
	self->priv->__transport_key_size_ = self->priv->_transport_key_length1;
}

guint8*
xmpp_xep_jet_transport_secret_get_initialization_vector (XmppXepJetTransportSecret* self,
                                                         gint* result_length1)
{
	guint8* result;
	guint8* _tmp0_;
	gint _tmp0__length1;
	guint8* _tmp1_;
	gint _tmp1__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_initialization_vector;
	_tmp0__length1 = self->priv->_initialization_vector_length1;
	_tmp1_ = _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	if (result_length1) {
		*result_length1 = _tmp1__length1;
	}
	result = _tmp1_;
	return result;
}

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

static void
xmpp_xep_jet_transport_secret_set_initialization_vector (XmppXepJetTransportSecret* self,
                                                         guint8* value,
                                                         gint value_length1)
{
	guint8* _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = (value != NULL) ? _vala_array_dup14 (value, value_length1) : value;
	_tmp0__length1 = value_length1;
	self->priv->_initialization_vector = (g_free (self->priv->_initialization_vector), NULL);
	self->priv->_initialization_vector = _tmp0_;
	self->priv->_initialization_vector_length1 = _tmp0__length1;
	self->priv->__initialization_vector_size_ = self->priv->_initialization_vector_length1;
}

static void
xmpp_xep_jet_value_transport_secret_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_xep_jet_value_transport_secret_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xep_jet_transport_secret_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_xep_jet_value_transport_secret_copy_value (const GValue* src_value,
                                                GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xep_jet_transport_secret_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_xep_jet_value_transport_secret_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_xep_jet_value_transport_secret_collect_value (GValue* value,
                                                   guint n_collect_values,
                                                   GTypeCValue* collect_values,
                                                   guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXepJetTransportSecret * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xep_jet_transport_secret_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_xep_jet_value_transport_secret_lcopy_value (const GValue* value,
                                                 guint n_collect_values,
                                                 GTypeCValue* collect_values,
                                                 guint collect_flags)
{
	XmppXepJetTransportSecret ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xep_jet_transport_secret_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_xep_jet_param_spec_transport_secret (const gchar* name,
                                          const gchar* nick,
                                          const gchar* blurb,
                                          GType object_type,
                                          GParamFlags flags)
{
	XmppXepJetParamSpecTransportSecret* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_XEP_JET_TYPE_TRANSPORT_SECRET), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_xep_jet_value_get_transport_secret (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_JET_TYPE_TRANSPORT_SECRET), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_xep_jet_value_set_transport_secret (GValue* value,
                                         gpointer v_object)
{
	XmppXepJetTransportSecret * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_JET_TYPE_TRANSPORT_SECRET));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_JET_TYPE_TRANSPORT_SECRET));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xep_jet_transport_secret_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_jet_transport_secret_unref (old);
	}
}

void
xmpp_xep_jet_value_take_transport_secret (GValue* value,
                                          gpointer v_object)
{
	XmppXepJetTransportSecret * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_JET_TYPE_TRANSPORT_SECRET));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_JET_TYPE_TRANSPORT_SECRET));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_jet_transport_secret_unref (old);
	}
}

static void
xmpp_xep_jet_transport_secret_class_init (XmppXepJetTransportSecretClass * klass,
                                          gpointer klass_data)
{
	xmpp_xep_jet_transport_secret_parent_class = g_type_class_peek_parent (klass);
	((XmppXepJetTransportSecretClass *) klass)->finalize = xmpp_xep_jet_transport_secret_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXepJetTransportSecret_private_offset);
}

static void
xmpp_xep_jet_transport_secret_instance_init (XmppXepJetTransportSecret * self,
                                             gpointer klass)
{
	self->priv = xmpp_xep_jet_transport_secret_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_xep_jet_transport_secret_finalize (XmppXepJetTransportSecret * obj)
{
	XmppXepJetTransportSecret * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JET_TYPE_TRANSPORT_SECRET, XmppXepJetTransportSecret);
	g_signal_handlers_destroy (self);
	self->priv->_transport_key = (g_free (self->priv->_transport_key), NULL);
	self->priv->_initialization_vector = (g_free (self->priv->_initialization_vector), NULL);
}

static GType
xmpp_xep_jet_transport_secret_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xep_jet_value_transport_secret_init, xmpp_xep_jet_value_transport_secret_free_value, xmpp_xep_jet_value_transport_secret_copy_value, xmpp_xep_jet_value_transport_secret_peek_pointer, "p", xmpp_xep_jet_value_transport_secret_collect_value, "p", xmpp_xep_jet_value_transport_secret_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJetTransportSecretClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jet_transport_secret_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJetTransportSecret), 0, (GInstanceInitFunc) xmpp_xep_jet_transport_secret_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xep_jet_transport_secret_type_id;
	xmpp_xep_jet_transport_secret_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXepJetTransportSecret", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXepJetTransportSecret_private_offset = g_type_add_instance_private (xmpp_xep_jet_transport_secret_type_id, sizeof (XmppXepJetTransportSecretPrivate));
	return xmpp_xep_jet_transport_secret_type_id;
}

GType
xmpp_xep_jet_transport_secret_get_type (void)
{
	static volatile gsize xmpp_xep_jet_transport_secret_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jet_transport_secret_type_id__once)) {
		GType xmpp_xep_jet_transport_secret_type_id;
		xmpp_xep_jet_transport_secret_type_id = xmpp_xep_jet_transport_secret_get_type_once ();
		g_once_init_leave (&xmpp_xep_jet_transport_secret_type_id__once, xmpp_xep_jet_transport_secret_type_id);
	}
	return xmpp_xep_jet_transport_secret_type_id__once;
}

gpointer
xmpp_xep_jet_transport_secret_ref (gpointer instance)
{
	XmppXepJetTransportSecret * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xep_jet_transport_secret_unref (gpointer instance)
{
	XmppXepJetTransportSecret * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XEP_JET_TRANSPORT_SECRET_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

gchar*
xmpp_xep_jet_envelop_encoding_get_type_uri (XmppXepJetEnvelopEncoding* self)
{
	XmppXepJetEnvelopEncodingIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_JET_ENVELOP_ENCODING_GET_INTERFACE (self);
	if (_iface_->get_type_uri) {
		return _iface_->get_type_uri (self);
	}
	return NULL;
}

XmppXepJetTransportSecret*
xmpp_xep_jet_envelop_encoding_decode_envolop (XmppXepJetEnvelopEncoding* self,
                                              XmppXmppStream* stream,
                                              XmppJid* local_full_jid,
                                              XmppJid* peer_full_jid,
                                              XmppStanzaNode* security,
                                              GError** error)
{
	XmppXepJetEnvelopEncodingIface* _iface_;
	g_return_val_if_fail (self != NULL, NULL);
	_iface_ = XMPP_XEP_JET_ENVELOP_ENCODING_GET_INTERFACE (self);
	if (_iface_->decode_envolop) {
		return _iface_->decode_envolop (self, stream, local_full_jid, peer_full_jid, security, error);
	}
	return NULL;
}

void
xmpp_xep_jet_envelop_encoding_encode_envelop (XmppXepJetEnvelopEncoding* self,
                                              XmppXmppStream* stream,
                                              XmppJid* local_full_jid,
                                              XmppJid* peer_full_jid,
                                              XmppXepJetSecurityParameters* security_params,
                                              XmppStanzaNode* security)
{
	XmppXepJetEnvelopEncodingIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = XMPP_XEP_JET_ENVELOP_ENCODING_GET_INTERFACE (self);
	if (_iface_->encode_envelop) {
		_iface_->encode_envelop (self, stream, local_full_jid, peer_full_jid, security_params, security);
	}
}

static void
xmpp_xep_jet_envelop_encoding_default_init (XmppXepJetEnvelopEncodingIface * iface,
                                            gpointer iface_data)
{
}

static GType
xmpp_xep_jet_envelop_encoding_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJetEnvelopEncodingIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jet_envelop_encoding_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType xmpp_xep_jet_envelop_encoding_type_id;
	xmpp_xep_jet_envelop_encoding_type_id = g_type_register_static (G_TYPE_INTERFACE, "XmppXepJetEnvelopEncoding", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (xmpp_xep_jet_envelop_encoding_type_id, G_TYPE_OBJECT);
	return xmpp_xep_jet_envelop_encoding_type_id;
}

GType
xmpp_xep_jet_envelop_encoding_get_type (void)
{
	static volatile gsize xmpp_xep_jet_envelop_encoding_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jet_envelop_encoding_type_id__once)) {
		GType xmpp_xep_jet_envelop_encoding_type_id;
		xmpp_xep_jet_envelop_encoding_type_id = xmpp_xep_jet_envelop_encoding_get_type_once ();
		g_once_init_leave (&xmpp_xep_jet_envelop_encoding_type_id__once, xmpp_xep_jet_envelop_encoding_type_id);
	}
	return xmpp_xep_jet_envelop_encoding_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;
}

