
/*** <<< INCLUDES [Flag] >>> ***/

#include <INTEGER.h>
#include <constr_SEQUENCE.h>
#include <ENUMERATED.h>

/*** <<< DEPS [Flag] >>> ***/

typedef enum field {
	field_red	= 0,
	field_green	= 1,
	field_blue	= 5
} e_field;
typedef enum field {
	field_red	= 3,
	field_green	= 4,
	field_blue	= 5
} e_field;

/*** <<< TYPE-DECLS [Flag] >>> ***/

typedef struct Flag_16P0 {
	INTEGER_t	*field	/* DEFAULT 5 */;
	
	/* Context for parsing across buffer boundaries */
	asn_struct_ctx_t _asn_ctx;
} Flag_16P0_t;
typedef struct Flag_16P1 {
	ENUMERATED_t	*field	/* DEFAULT 5 */;
	
	/* Context for parsing across buffer boundaries */
	asn_struct_ctx_t _asn_ctx;
} Flag_16P1_t;

/*** <<< FUNC-DECLS [Flag] >>> ***/

extern asn_TYPE_descriptor_t asn_DEF_Flag_16P0;
/* extern asn_TYPE_descriptor_t asn_DEF_field_7;	// (Use -fall-defs-global to expose) */
extern asn_TYPE_descriptor_t asn_DEF_Flag_16P1;

/*** <<< CODE [Flag] >>> ***/

static int
field_7_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	/* Replace with underlying type checker */
	td->check_constraints = asn_DEF_ENUMERATED.check_constraints;
	return td->check_constraints(td, sptr, ctfailcb, app_key);
}

/*
 * This type is implemented using ENUMERATED,
 * so here we adjust the DEF accordingly.
 */
static void
field_7_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
	td->free_struct    = asn_DEF_ENUMERATED.free_struct;
	td->print_struct   = asn_DEF_ENUMERATED.print_struct;
	td->ber_decoder    = asn_DEF_ENUMERATED.ber_decoder;
	td->der_encoder    = asn_DEF_ENUMERATED.der_encoder;
	td->xer_decoder    = asn_DEF_ENUMERATED.xer_decoder;
	td->xer_encoder    = asn_DEF_ENUMERATED.xer_encoder;
	td->uper_decoder   = asn_DEF_ENUMERATED.uper_decoder;
	td->uper_encoder   = asn_DEF_ENUMERATED.uper_encoder;
	if(!td->per_constraints)
		td->per_constraints = asn_DEF_ENUMERATED.per_constraints;
	td->elements       = asn_DEF_ENUMERATED.elements;
	td->elements_count = asn_DEF_ENUMERATED.elements_count;
     /* td->specifics      = asn_DEF_ENUMERATED.specifics;	// Defined explicitly */
}

static void
field_7_free(asn_TYPE_descriptor_t *td,
		void *struct_ptr, int contents_only) {
	field_7_inherit_TYPE_descriptor(td);
	td->free_struct(td, struct_ptr, contents_only);
}

static int
field_7_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
	field_7_inherit_TYPE_descriptor(td);
	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}

static asn_dec_rval_t
field_7_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
		void **structure, const void *bufptr, size_t size, int tag_mode) {
	field_7_inherit_TYPE_descriptor(td);
	return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}

static asn_enc_rval_t
field_7_encode_der(asn_TYPE_descriptor_t *td,
		void *structure, int tag_mode, ber_tlv_tag_t tag,
		asn_app_consume_bytes_f *cb, void *app_key) {
	field_7_inherit_TYPE_descriptor(td);
	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}

static asn_dec_rval_t
field_7_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
		void **structure, const char *opt_mname, const void *bufptr, size_t size) {
	field_7_inherit_TYPE_descriptor(td);
	return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
}

static asn_enc_rval_t
field_7_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
		int ilevel, enum xer_encoder_flags_e flags,
		asn_app_consume_bytes_f *cb, void *app_key) {
	field_7_inherit_TYPE_descriptor(td);
	return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}


/*** <<< STAT-DEFS [Flag] >>> ***/

static int asn_DFL_2_set_5(int set_value, void **sptr) {
	INTEGER_t *st = *sptr;
	
	if(!st) {
		if(!set_value) return -1;	/* Not a default value */
		st = (*sptr = CALLOC(1, sizeof(*st)));
		if(!st) return -1;
	}
	
	if(set_value) {
		/* Install default value 5 */
		return asn_long2INTEGER(st, 5);
	} else {
		/* Test default value 5 */
		long value;
		if(asn_INTEGER2long(st, &value))
			return -1;
		return (value == 5);
	}
}
static asn_TYPE_member_t asn_MBR_Flag_16P0_1[] = {
	{ ATF_POINTER, 1, offsetof(struct Flag_16P0, field),
		.tag = (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
		.tag_mode = 0,
		.type = &asn_DEF_INTEGER,
		.memb_constraints = 0,	/* Defer constraints checking to the member type */
		.per_constraints = 0,	/* PER is not compiled, use -gen-PER */
		.default_value = asn_DFL_2_set_5,	/* DEFAULT 5 */
		.name = "field"
		},
};
static ber_tlv_tag_t asn_DEF_Flag_16P0_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_Flag_16P0_tag2el_1[] = {
    { (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* field at 18 */
};
static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P0_specs_1 = {
	sizeof(struct Flag_16P0),
	offsetof(struct Flag_16P0, _asn_ctx),
	asn_MAP_Flag_16P0_tag2el_1,
	1,	/* Count of tags in the map */
	0, 0, 0,	/* Optional elements (not needed) */
	-1,	/* Start extensions */
	-1	/* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Flag_16P0 = {
	"Flag",
	"Flag",
	SEQUENCE_free,
	SEQUENCE_print,
	SEQUENCE_constraint,
	SEQUENCE_decode_ber,
	SEQUENCE_encode_der,
	SEQUENCE_decode_xer,
	SEQUENCE_encode_xer,
	0, 0,	/* No PER support, use "-gen-PER" to enable */
	0,	/* Use generic outmost tag fetcher */
	asn_DEF_Flag_16P0_tags_1,
	sizeof(asn_DEF_Flag_16P0_tags_1)
		/sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */
	asn_DEF_Flag_16P0_tags_1,	/* Same as above */
	sizeof(asn_DEF_Flag_16P0_tags_1)
		/sizeof(asn_DEF_Flag_16P0_tags_1[0]), /* 1 */
	0,	/* No PER visible constraints */
	asn_MBR_Flag_16P0_1,
	1,	/* Elements count */
	&asn_SPC_Flag_16P0_specs_1	/* Additional specs */
};

static int asn_DFL_7_set_5(int set_value, void **sptr) {
	ENUMERATED_t *st = *sptr;
	
	if(!st) {
		if(!set_value) return -1;	/* Not a default value */
		st = (*sptr = CALLOC(1, sizeof(*st)));
		if(!st) return -1;
	}
	
	if(set_value) {
		/* Install default value 5 */
		return asn_long2INTEGER(st, 5);
	} else {
		/* Test default value 5 */
		long value;
		if(asn_INTEGER2long(st, &value))
			return -1;
		return (value == 5);
	}
}
static asn_INTEGER_enum_map_t asn_MAP_field_value2enum_7[] = {
	{ 3,	3,	"red" },
	{ 4,	5,	"green" },
	{ 5,	4,	"blue" }
};
static unsigned int asn_MAP_field_enum2value_7[] = {
	2,	/* blue(5) */
	1,	/* green(4) */
	0	/* red(3) */
};
static asn_INTEGER_specifics_t asn_SPC_field_specs_7 = {
	asn_MAP_field_value2enum_7,	/* "tag" => N; sorted by tag */
	asn_MAP_field_enum2value_7,	/* N => "tag"; sorted by N */
	3,	/* Number of elements in the maps */
	0,	/* Enumeration is not extensible */
	1,	/* Strict enumeration */
	0,	/* Native long size */
	0
};
static ber_tlv_tag_t asn_DEF_field_tags_7[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
static /* Use -fall-defs-global to expose */
asn_TYPE_descriptor_t asn_DEF_field_7 = {
	"field",
	"field",
	field_7_free,
	field_7_print,
	field_7_constraint,
	field_7_decode_ber,
	field_7_encode_der,
	field_7_decode_xer,
	field_7_encode_xer,
	0, 0,	/* No PER support, use "-gen-PER" to enable */
	0,	/* Use generic outmost tag fetcher */
	asn_DEF_field_tags_7,
	sizeof(asn_DEF_field_tags_7)
		/sizeof(asn_DEF_field_tags_7[0]), /* 1 */
	asn_DEF_field_tags_7,	/* Same as above */
	sizeof(asn_DEF_field_tags_7)
		/sizeof(asn_DEF_field_tags_7[0]), /* 1 */
	0,	/* No PER visible constraints */
	0, 0,	/* Defined elsewhere */
	&asn_SPC_field_specs_7	/* Additional specs */
};

static asn_TYPE_member_t asn_MBR_Flag_16P1_6[] = {
	{ ATF_POINTER, 1, offsetof(struct Flag_16P1, field),
		.tag = (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
		.tag_mode = 0,
		.type = &asn_DEF_field_7,
		.memb_constraints = 0,	/* Defer constraints checking to the member type */
		.per_constraints = 0,	/* PER is not compiled, use -gen-PER */
		.default_value = asn_DFL_7_set_5,	/* DEFAULT 5 */
		.name = "field"
		},
};
static ber_tlv_tag_t asn_DEF_Flag_16P1_tags_6[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_Flag_16P1_tag2el_6[] = {
    { (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 0, 0, 0 } /* field at 19 */
};
static asn_SEQUENCE_specifics_t asn_SPC_Flag_16P1_specs_6 = {
	sizeof(struct Flag_16P1),
	offsetof(struct Flag_16P1, _asn_ctx),
	asn_MAP_Flag_16P1_tag2el_6,
	1,	/* Count of tags in the map */
	0, 0, 0,	/* Optional elements (not needed) */
	-1,	/* Start extensions */
	-1	/* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_Flag_16P1 = {
	"Flag",
	"Flag",
	SEQUENCE_free,
	SEQUENCE_print,
	SEQUENCE_constraint,
	SEQUENCE_decode_ber,
	SEQUENCE_encode_der,
	SEQUENCE_decode_xer,
	SEQUENCE_encode_xer,
	0, 0,	/* No PER support, use "-gen-PER" to enable */
	0,	/* Use generic outmost tag fetcher */
	asn_DEF_Flag_16P1_tags_6,
	sizeof(asn_DEF_Flag_16P1_tags_6)
		/sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */
	asn_DEF_Flag_16P1_tags_6,	/* Same as above */
	sizeof(asn_DEF_Flag_16P1_tags_6)
		/sizeof(asn_DEF_Flag_16P1_tags_6[0]), /* 1 */
	0,	/* No PER visible constraints */
	asn_MBR_Flag_16P1_6,
	1,	/* Elements count */
	&asn_SPC_Flag_16P1_specs_6	/* Additional specs */
};


/*** <<< INCLUDES [IntegerColorFlag] >>> ***/

#include "Flag.h"

/*** <<< TYPE-DECLS [IntegerColorFlag] >>> ***/

typedef Flag_16P0_t	 IntegerColorFlag_t;

/*** <<< FUNC-DECLS [IntegerColorFlag] >>> ***/

extern asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag;
asn_struct_free_f IntegerColorFlag_free;
asn_struct_print_f IntegerColorFlag_print;
asn_constr_check_f IntegerColorFlag_constraint;
ber_type_decoder_f IntegerColorFlag_decode_ber;
der_type_encoder_f IntegerColorFlag_encode_der;
xer_type_decoder_f IntegerColorFlag_decode_xer;
xer_type_encoder_f IntegerColorFlag_encode_xer;

/*** <<< CODE [IntegerColorFlag] >>> ***/

int
IntegerColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	/* Replace with underlying type checker */
	td->check_constraints = asn_DEF_Flag_16P0.check_constraints;
	return td->check_constraints(td, sptr, ctfailcb, app_key);
}

/*
 * This type is implemented using Flag_16P0,
 * so here we adjust the DEF accordingly.
 */
static void
IntegerColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
	td->free_struct    = asn_DEF_Flag_16P0.free_struct;
	td->print_struct   = asn_DEF_Flag_16P0.print_struct;
	td->ber_decoder    = asn_DEF_Flag_16P0.ber_decoder;
	td->der_encoder    = asn_DEF_Flag_16P0.der_encoder;
	td->xer_decoder    = asn_DEF_Flag_16P0.xer_decoder;
	td->xer_encoder    = asn_DEF_Flag_16P0.xer_encoder;
	td->uper_decoder   = asn_DEF_Flag_16P0.uper_decoder;
	td->uper_encoder   = asn_DEF_Flag_16P0.uper_encoder;
	if(!td->per_constraints)
		td->per_constraints = asn_DEF_Flag_16P0.per_constraints;
	td->elements       = asn_DEF_Flag_16P0.elements;
	td->elements_count = asn_DEF_Flag_16P0.elements_count;
	td->specifics      = asn_DEF_Flag_16P0.specifics;
}

void
IntegerColorFlag_free(asn_TYPE_descriptor_t *td,
		void *struct_ptr, int contents_only) {
	IntegerColorFlag_1_inherit_TYPE_descriptor(td);
	td->free_struct(td, struct_ptr, contents_only);
}

int
IntegerColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
	IntegerColorFlag_1_inherit_TYPE_descriptor(td);
	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}

asn_dec_rval_t
IntegerColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
		void **structure, const void *bufptr, size_t size, int tag_mode) {
	IntegerColorFlag_1_inherit_TYPE_descriptor(td);
	return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}

asn_enc_rval_t
IntegerColorFlag_encode_der(asn_TYPE_descriptor_t *td,
		void *structure, int tag_mode, ber_tlv_tag_t tag,
		asn_app_consume_bytes_f *cb, void *app_key) {
	IntegerColorFlag_1_inherit_TYPE_descriptor(td);
	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}

asn_dec_rval_t
IntegerColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
		void **structure, const char *opt_mname, const void *bufptr, size_t size) {
	IntegerColorFlag_1_inherit_TYPE_descriptor(td);
	return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
}

asn_enc_rval_t
IntegerColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
		int ilevel, enum xer_encoder_flags_e flags,
		asn_app_consume_bytes_f *cb, void *app_key) {
	IntegerColorFlag_1_inherit_TYPE_descriptor(td);
	return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}


/*** <<< STAT-DEFS [IntegerColorFlag] >>> ***/

static ber_tlv_tag_t asn_DEF_IntegerColorFlag_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_TYPE_descriptor_t asn_DEF_IntegerColorFlag = {
	"IntegerColorFlag",
	"IntegerColorFlag",
	IntegerColorFlag_free,
	IntegerColorFlag_print,
	IntegerColorFlag_constraint,
	IntegerColorFlag_decode_ber,
	IntegerColorFlag_encode_der,
	IntegerColorFlag_decode_xer,
	IntegerColorFlag_encode_xer,
	0, 0,	/* No PER support, use "-gen-PER" to enable */
	0,	/* Use generic outmost tag fetcher */
	asn_DEF_IntegerColorFlag_tags_1,
	sizeof(asn_DEF_IntegerColorFlag_tags_1)
		/sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */
	asn_DEF_IntegerColorFlag_tags_1,	/* Same as above */
	sizeof(asn_DEF_IntegerColorFlag_tags_1)
		/sizeof(asn_DEF_IntegerColorFlag_tags_1[0]), /* 1 */
	0,	/* No PER visible constraints */
	0, 0,	/* Defined elsewhere */
	0	/* No specifics */
};


/*** <<< INCLUDES [EnumeratedColorFlag] >>> ***/

#include "Flag.h"

/*** <<< TYPE-DECLS [EnumeratedColorFlag] >>> ***/

typedef Flag_16P1_t	 EnumeratedColorFlag_t;

/*** <<< FUNC-DECLS [EnumeratedColorFlag] >>> ***/

extern asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag;
asn_struct_free_f EnumeratedColorFlag_free;
asn_struct_print_f EnumeratedColorFlag_print;
asn_constr_check_f EnumeratedColorFlag_constraint;
ber_type_decoder_f EnumeratedColorFlag_decode_ber;
der_type_encoder_f EnumeratedColorFlag_encode_der;
xer_type_decoder_f EnumeratedColorFlag_decode_xer;
xer_type_encoder_f EnumeratedColorFlag_encode_xer;

/*** <<< CODE [EnumeratedColorFlag] >>> ***/

int
EnumeratedColorFlag_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
	/* Replace with underlying type checker */
	td->check_constraints = asn_DEF_Flag_16P1.check_constraints;
	return td->check_constraints(td, sptr, ctfailcb, app_key);
}

/*
 * This type is implemented using Flag_16P1,
 * so here we adjust the DEF accordingly.
 */
static void
EnumeratedColorFlag_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
	td->free_struct    = asn_DEF_Flag_16P1.free_struct;
	td->print_struct   = asn_DEF_Flag_16P1.print_struct;
	td->ber_decoder    = asn_DEF_Flag_16P1.ber_decoder;
	td->der_encoder    = asn_DEF_Flag_16P1.der_encoder;
	td->xer_decoder    = asn_DEF_Flag_16P1.xer_decoder;
	td->xer_encoder    = asn_DEF_Flag_16P1.xer_encoder;
	td->uper_decoder   = asn_DEF_Flag_16P1.uper_decoder;
	td->uper_encoder   = asn_DEF_Flag_16P1.uper_encoder;
	if(!td->per_constraints)
		td->per_constraints = asn_DEF_Flag_16P1.per_constraints;
	td->elements       = asn_DEF_Flag_16P1.elements;
	td->elements_count = asn_DEF_Flag_16P1.elements_count;
	td->specifics      = asn_DEF_Flag_16P1.specifics;
}

void
EnumeratedColorFlag_free(asn_TYPE_descriptor_t *td,
		void *struct_ptr, int contents_only) {
	EnumeratedColorFlag_1_inherit_TYPE_descriptor(td);
	td->free_struct(td, struct_ptr, contents_only);
}

int
EnumeratedColorFlag_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
		int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
	EnumeratedColorFlag_1_inherit_TYPE_descriptor(td);
	return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}

asn_dec_rval_t
EnumeratedColorFlag_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
		void **structure, const void *bufptr, size_t size, int tag_mode) {
	EnumeratedColorFlag_1_inherit_TYPE_descriptor(td);
	return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}

asn_enc_rval_t
EnumeratedColorFlag_encode_der(asn_TYPE_descriptor_t *td,
		void *structure, int tag_mode, ber_tlv_tag_t tag,
		asn_app_consume_bytes_f *cb, void *app_key) {
	EnumeratedColorFlag_1_inherit_TYPE_descriptor(td);
	return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}

asn_dec_rval_t
EnumeratedColorFlag_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
		void **structure, const char *opt_mname, const void *bufptr, size_t size) {
	EnumeratedColorFlag_1_inherit_TYPE_descriptor(td);
	return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
}

asn_enc_rval_t
EnumeratedColorFlag_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
		int ilevel, enum xer_encoder_flags_e flags,
		asn_app_consume_bytes_f *cb, void *app_key) {
	EnumeratedColorFlag_1_inherit_TYPE_descriptor(td);
	return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}


/*** <<< STAT-DEFS [EnumeratedColorFlag] >>> ***/

static ber_tlv_tag_t asn_DEF_EnumeratedColorFlag_tags_1[] = {
	(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
asn_TYPE_descriptor_t asn_DEF_EnumeratedColorFlag = {
	"EnumeratedColorFlag",
	"EnumeratedColorFlag",
	EnumeratedColorFlag_free,
	EnumeratedColorFlag_print,
	EnumeratedColorFlag_constraint,
	EnumeratedColorFlag_decode_ber,
	EnumeratedColorFlag_encode_der,
	EnumeratedColorFlag_decode_xer,
	EnumeratedColorFlag_encode_xer,
	0, 0,	/* No PER support, use "-gen-PER" to enable */
	0,	/* Use generic outmost tag fetcher */
	asn_DEF_EnumeratedColorFlag_tags_1,
	sizeof(asn_DEF_EnumeratedColorFlag_tags_1)
		/sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */
	asn_DEF_EnumeratedColorFlag_tags_1,	/* Same as above */
	sizeof(asn_DEF_EnumeratedColorFlag_tags_1)
		/sizeof(asn_DEF_EnumeratedColorFlag_tags_1[0]), /* 1 */
	0,	/* No PER visible constraints */
	0, 0,	/* Defined elsewhere */
	0	/* No specifics */
};

