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

#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <glib.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 _g_free0(var) (var = (g_free (var), NULL))

static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GQuark
xmpp_xep_jingle_iq_error_quark (void)
{
	return g_quark_from_static_string ("xmpp-xep-jingle-iq-error-quark");
}

static GType
xmpp_xep_jingle_iq_error_get_type_once (void)
{
	static const GEnumValue values[] = {{XMPP_XEP_JINGLE_IQ_ERROR_BAD_REQUEST, "XMPP_XEP_JINGLE_IQ_ERROR_BAD_REQUEST", "bad-request"}, {XMPP_XEP_JINGLE_IQ_ERROR_NOT_ACCEPTABLE, "XMPP_XEP_JINGLE_IQ_ERROR_NOT_ACCEPTABLE", "not-acceptable"}, {XMPP_XEP_JINGLE_IQ_ERROR_NOT_IMPLEMENTED, "XMPP_XEP_JINGLE_IQ_ERROR_NOT_IMPLEMENTED", "not-implemented"}, {XMPP_XEP_JINGLE_IQ_ERROR_UNSUPPORTED_INFO, "XMPP_XEP_JINGLE_IQ_ERROR_UNSUPPORTED_INFO", "unsupported-info"}, {XMPP_XEP_JINGLE_IQ_ERROR_OUT_OF_ORDER, "XMPP_XEP_JINGLE_IQ_ERROR_OUT_OF_ORDER", "out-of-order"}, {XMPP_XEP_JINGLE_IQ_ERROR_RESOURCE_CONSTRAINT, "XMPP_XEP_JINGLE_IQ_ERROR_RESOURCE_CONSTRAINT", "resource-constraint"}, {0, NULL, NULL}};
	GType xmpp_xep_jingle_iq_error_type_id;
	xmpp_xep_jingle_iq_error_type_id = g_enum_register_static ("XmppXepJingleIqError", values);
	return xmpp_xep_jingle_iq_error_type_id;
}

GType
xmpp_xep_jingle_iq_error_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_iq_error_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_iq_error_type_id__once)) {
		GType xmpp_xep_jingle_iq_error_type_id;
		xmpp_xep_jingle_iq_error_type_id = xmpp_xep_jingle_iq_error_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_iq_error_type_id__once, xmpp_xep_jingle_iq_error_type_id);
	}
	return xmpp_xep_jingle_iq_error_type_id__once;
}

GQuark
xmpp_xep_jingle_error_quark (void)
{
	return g_quark_from_static_string ("xmpp-xep-jingle-error-quark");
}

static GType
xmpp_xep_jingle_error_get_type_once (void)
{
	static const GEnumValue values[] = {{XMPP_XEP_JINGLE_ERROR_GENERAL, "XMPP_XEP_JINGLE_ERROR_GENERAL", "general"}, {XMPP_XEP_JINGLE_ERROR_BAD_REQUEST, "XMPP_XEP_JINGLE_ERROR_BAD_REQUEST", "bad-request"}, {XMPP_XEP_JINGLE_ERROR_INVALID_PARAMETERS, "XMPP_XEP_JINGLE_ERROR_INVALID_PARAMETERS", "invalid-parameters"}, {XMPP_XEP_JINGLE_ERROR_UNSUPPORTED_TRANSPORT, "XMPP_XEP_JINGLE_ERROR_UNSUPPORTED_TRANSPORT", "unsupported-transport"}, {XMPP_XEP_JINGLE_ERROR_UNSUPPORTED_SECURITY, "XMPP_XEP_JINGLE_ERROR_UNSUPPORTED_SECURITY", "unsupported-security"}, {XMPP_XEP_JINGLE_ERROR_NO_SHARED_PROTOCOLS, "XMPP_XEP_JINGLE_ERROR_NO_SHARED_PROTOCOLS", "no-shared-protocols"}, {XMPP_XEP_JINGLE_ERROR_TRANSPORT_ERROR, "XMPP_XEP_JINGLE_ERROR_TRANSPORT_ERROR", "transport-error"}, {0, NULL, NULL}};
	GType xmpp_xep_jingle_error_type_id;
	xmpp_xep_jingle_error_type_id = g_enum_register_static ("XmppXepJingleError", values);
	return xmpp_xep_jingle_error_type_id;
}

GType
xmpp_xep_jingle_error_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_error_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_error_type_id__once)) {
		GType xmpp_xep_jingle_error_type_id;
		xmpp_xep_jingle_error_type_id = xmpp_xep_jingle_error_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_error_type_id__once, xmpp_xep_jingle_error_type_id);
	}
	return xmpp_xep_jingle_error_type_id__once;
}

gchar*
xmpp_xep_jingle_senders_to_string (XmppXepJingleSenders self)
{
	gchar* result;
	switch (self) {
		case XMPP_XEP_JINGLE_SENDERS_BOTH:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("both");
			result = _tmp0_;
			return result;
		}
		case XMPP_XEP_JINGLE_SENDERS_INITIATOR:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("initiator");
			result = _tmp1_;
			return result;
		}
		case XMPP_XEP_JINGLE_SENDERS_NONE:
		{
			gchar* _tmp2_;
			_tmp2_ = g_strdup ("none");
			result = _tmp2_;
			return result;
		}
		case XMPP_XEP_JINGLE_SENDERS_RESPONDER:
		{
			gchar* _tmp3_;
			_tmp3_ = g_strdup ("responder");
			result = _tmp3_;
			return result;
		}
		default:
		break;
	}
	g_assert_not_reached ();
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

XmppXepJingleSenders
xmpp_xep_jingle_senders_parse (const gchar* senders,
                               GError** error)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	static GQuark _tmp1_label2 = 0;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* _tmp6_;
	GError* _tmp7_;
	GError* _inner_error0_ = NULL;
	XmppXepJingleSenders result;
	if (senders == NULL) {
		result = XMPP_XEP_JINGLE_SENDERS_BOTH;
		return result;
	}
	_tmp0_ = senders;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("initiator")))) {
		switch (0) {
			default:
			{
				result = XMPP_XEP_JINGLE_SENDERS_INITIATOR;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("responder")))) {
		switch (0) {
			default:
			{
				result = XMPP_XEP_JINGLE_SENDERS_RESPONDER;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("both")))) {
		switch (0) {
			default:
			{
				result = XMPP_XEP_JINGLE_SENDERS_BOTH;
				return result;
			}
		}
	}
	_tmp3_ = string_to_string (senders);
	_tmp4_ = g_strconcat ("invalid role ", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_error_new_literal (XMPP_XEP_JINGLE_IQ_ERROR, XMPP_XEP_JINGLE_IQ_ERROR_BAD_REQUEST, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_inner_error0_ = _tmp7_;
	if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
		g_propagate_error (error, _inner_error0_);
		return 0;
	} 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 0;
	}
}

static GType
xmpp_xep_jingle_senders_get_type_once (void)
{
	static const GEnumValue values[] = {{XMPP_XEP_JINGLE_SENDERS_BOTH, "XMPP_XEP_JINGLE_SENDERS_BOTH", "both"}, {XMPP_XEP_JINGLE_SENDERS_INITIATOR, "XMPP_XEP_JINGLE_SENDERS_INITIATOR", "initiator"}, {XMPP_XEP_JINGLE_SENDERS_NONE, "XMPP_XEP_JINGLE_SENDERS_NONE", "none"}, {XMPP_XEP_JINGLE_SENDERS_RESPONDER, "XMPP_XEP_JINGLE_SENDERS_RESPONDER", "responder"}, {0, NULL, NULL}};
	GType xmpp_xep_jingle_senders_type_id;
	xmpp_xep_jingle_senders_type_id = g_enum_register_static ("XmppXepJingleSenders", values);
	return xmpp_xep_jingle_senders_type_id;
}

GType
xmpp_xep_jingle_senders_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_senders_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_senders_type_id__once)) {
		GType xmpp_xep_jingle_senders_type_id;
		xmpp_xep_jingle_senders_type_id = xmpp_xep_jingle_senders_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_senders_type_id__once, xmpp_xep_jingle_senders_type_id);
	}
	return xmpp_xep_jingle_senders_type_id__once;
}

gchar*
xmpp_xep_jingle_role_to_string (XmppXepJingleRole self)
{
	gchar* result;
	switch (self) {
		case XMPP_XEP_JINGLE_ROLE_INITIATOR:
		{
			gchar* _tmp0_;
			_tmp0_ = g_strdup ("initiator");
			result = _tmp0_;
			return result;
		}
		case XMPP_XEP_JINGLE_ROLE_RESPONDER:
		{
			gchar* _tmp1_;
			_tmp1_ = g_strdup ("responder");
			result = _tmp1_;
			return result;
		}
		default:
		break;
	}
	g_assert_not_reached ();
}

XmppXepJingleRole
xmpp_xep_jingle_role_parse (const gchar* role,
                            GError** error)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	GError* _tmp6_;
	GError* _tmp7_;
	GError* _inner_error0_ = NULL;
	XmppXepJingleRole result;
	g_return_val_if_fail (role != NULL, 0);
	_tmp0_ = role;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("initiator")))) {
		switch (0) {
			default:
			{
				result = XMPP_XEP_JINGLE_ROLE_INITIATOR;
				return result;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("responder")))) {
		switch (0) {
			default:
			{
				result = XMPP_XEP_JINGLE_ROLE_RESPONDER;
				return result;
			}
		}
	}
	_tmp3_ = string_to_string (role);
	_tmp4_ = g_strconcat ("invalid role ", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_error_new_literal (XMPP_XEP_JINGLE_IQ_ERROR, XMPP_XEP_JINGLE_IQ_ERROR_BAD_REQUEST, _tmp5_);
	_tmp7_ = _tmp6_;
	_g_free0 (_tmp5_);
	_inner_error0_ = _tmp7_;
	if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
		g_propagate_error (error, _inner_error0_);
		return 0;
	} 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 0;
	}
}

static GType
xmpp_xep_jingle_role_get_type_once (void)
{
	static const GEnumValue values[] = {{XMPP_XEP_JINGLE_ROLE_INITIATOR, "XMPP_XEP_JINGLE_ROLE_INITIATOR", "initiator"}, {XMPP_XEP_JINGLE_ROLE_RESPONDER, "XMPP_XEP_JINGLE_ROLE_RESPONDER", "responder"}, {0, NULL, NULL}};
	GType xmpp_xep_jingle_role_type_id;
	xmpp_xep_jingle_role_type_id = g_enum_register_static ("XmppXepJingleRole", values);
	return xmpp_xep_jingle_role_type_id;
}

GType
xmpp_xep_jingle_role_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_role_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_role_type_id__once)) {
		GType xmpp_xep_jingle_role_type_id;
		xmpp_xep_jingle_role_type_id = xmpp_xep_jingle_role_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_role_type_id__once, xmpp_xep_jingle_role_type_id);
	}
	return xmpp_xep_jingle_role_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;
}

