Move type operations to another structure
Every type has free, print, check_constraints, ber_decoder, der_encoder,
xer_decoder, xer_encoder, uper_decoder, uper_encoder and outmost_tag
operations. We move them out to a separate structure asn_TYPE_operation_t.
Combined with previous logic simplification, these operations are based
on ASN.1 basic types, constructed types and string types. So we can
reduce the space occupied by asn_TYPE_descriptor_t variables.
diff --git a/skeletons/oer_encoder.c b/skeletons/oer_encoder.c
index 490043c..af3c7d1 100644
--- a/skeletons/oer_encoder.c
+++ b/skeletons/oer_encoder.c
@@ -17,7 +17,7 @@
/*
* Invoke type-specific encoder.
*/
- return type_descriptor->oer_encoder(type_descriptor, 0,
+ return type_descriptor->op->oer_encoder(type_descriptor, 0,
struct_ptr, /* Pointer to the destination structure */
consume_bytes, app_key);
}
@@ -58,14 +58,14 @@
arg.buffer = buffer;
arg.left = buffer_size;
- if(type_descriptor->oer_encoder == NULL) {
+ if(type_descriptor->op->oer_encoder == NULL) {
ec.encoded = -1;
ec.failed_type = type_descriptor;
ec.structure_ptr = struct_ptr;
ASN_DEBUG("OER encoder is not defined for %s",
type_descriptor->name);
} else {
- ec = type_descriptor->oer_encoder(
+ ec = type_descriptor->op->oer_encoder(
type_descriptor, constraints,
struct_ptr, /* Pointer to the destination structure */
encode_to_buffer_cb, &arg);