static const char* get_frame_type_as_string(AMQP_VALUE descriptor)
{
	const char* result;

	if (is_sasl_mechanisms_type_by_descriptor(descriptor))
	{
		result = "[SASL MECHANISMS]";
	}
	else if (is_sasl_init_type_by_descriptor(descriptor))
	{
		result = "[SASL INIT]";
	}
	else if (is_sasl_challenge_type_by_descriptor(descriptor))
	{
		result = "[SASL CHALLENGE]";
	}
	else if (is_sasl_response_type_by_descriptor(descriptor))
	{
		result = "[SASL RESPONSE]";
	}
	else if (is_sasl_outcome_type_by_descriptor(descriptor))
	{
		result = "[SASL OUTCOME]";
	}
	else
	{
		result = "[Unknown]";
	}

	return result;
}
static void amqp_value_decoded(void* context, AMQP_VALUE decoded_value)
{
	SASL_FRAME_CODEC_INSTANCE* sasl_frame_codec_instance = (SASL_FRAME_CODEC_INSTANCE*)context;
	AMQP_VALUE descriptor = amqpvalue_get_inplace_descriptor(decoded_value);

	if (descriptor == NULL)
	{
		sasl_frame_codec_instance->decode_state = SASL_FRAME_DECODE_ERROR;

		/* Codes_SRS_SASL_FRAME_CODEC_01_049: [If any error occurs while decoding a frame, the decoder shall call the on_sasl_frame_codec_error and pass to it the callback_context, both of those being the ones given to sasl_frame_codec_create.] */
		sasl_frame_codec_instance->on_sasl_frame_codec_error(sasl_frame_codec_instance->callback_context);
	}
	else
	{
		/* Codes_SRS_SASL_FRAME_CODEC_01_009: [The frame body of a SASL frame MUST contain exactly one AMQP type, whose type encoding MUST have provides=“sasl-frame”.] */
		if (!is_sasl_mechanisms_type_by_descriptor(descriptor) &&
			!is_sasl_init_type_by_descriptor(descriptor) &&
			!is_sasl_challenge_type_by_descriptor(descriptor) &&
			!is_sasl_response_type_by_descriptor(descriptor) &&
			!is_sasl_outcome_type_by_descriptor(descriptor))
		{
			sasl_frame_codec_instance->decode_state = SASL_FRAME_DECODE_ERROR;

			/* Codes_SRS_SASL_FRAME_CODEC_01_049: [If any error occurs while decoding a frame, the decoder shall call the on_sasl_frame_codec_error and pass to it the callback_context, both of those being the ones given to sasl_frame_codec_create.] */
			sasl_frame_codec_instance->on_sasl_frame_codec_error(sasl_frame_codec_instance->callback_context);
		}
		else
		{
			sasl_frame_codec_instance->decoded_sasl_frame_value = decoded_value;
		}
	}
}