Combined constraints and introduced value randomizer.
diff --git a/skeletons/UTCTime.c b/skeletons/UTCTime.c
index 32c5817..55c7506 100644
--- a/skeletons/UTCTime.c
+++ b/skeletons/UTCTime.c
@@ -50,21 +50,20 @@
OCTET_STRING_decode_uper,
OCTET_STRING_encode_uper,
#endif /* ASN_DISABLE_PER_SUPPORT */
+ UTCTime_random_fill,
0 /* Use generic outmost tag fetcher */
};
asn_TYPE_descriptor_t asn_DEF_UTCTime = {
"UTCTime",
"UTCTime",
&asn_OP_UTCTime,
- UTCTime_constraint,
asn_DEF_UTCTime_tags,
sizeof(asn_DEF_UTCTime_tags)
/ sizeof(asn_DEF_UTCTime_tags[0]) - 2,
asn_DEF_UTCTime_tags,
sizeof(asn_DEF_UTCTime_tags)
/ sizeof(asn_DEF_UTCTime_tags[0]),
- 0, /* No OER visible constraints */
- &asn_DEF_UTCTime_constraints,
+ { 0, &asn_DEF_UTCTime_constraints, UTCTime_constraint },
0, 0, /* No members */
0 /* No specifics */
};
@@ -194,3 +193,35 @@
return (UTCTime_t *)gt;
}
+
+asn_random_fill_result_t
+UTCTime_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
+ const asn_encoding_constraints_t *constraints,
+ size_t max_length) {
+ asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
+ asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
+ asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
+ static const char *values[] = {
+ "700101000000", "700101000000-0000", "700101000000+0000",
+ "700101000000Z", "821106210623", "691106210827-0500",
+ "821106210629Z",
+ };
+ size_t rnd = asn_random_between(0, sizeof(values)/sizeof(values[0])-1);
+
+ (void)constraints;
+
+ if(max_length < sizeof("yymmddhhmmss")) {
+ return result_skipped;
+ }
+
+ if(*sptr) {
+ if(OCTET_STRING_fromBuf(*sptr, values[rnd], -1) != 0) {
+ if(!sptr) return result_failed;
+ }
+ } else {
+ *sptr = OCTET_STRING_new_fromBuf(td, values[rnd], -1);
+ if(!sptr) return result_failed;
+ }
+
+ return result_ok;
+}