static int memb_sbasZgDotDot_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= -512 && value <= 511)) { /* Constraint check succeeded */ return 0; } else { _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } }
int TrailerWeight_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0 && value <= 65535)) { /* Constraint check succeeded */ return 0; } else { _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } }
static int memb_edch_PhysicalLayerCategory_extension2_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 8 && value <= 9)) { /* Constraint check succeeded */ return 0; } else { _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } }
static int memb_cqi_PUCCH_ResourceIndex_constraint_3(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { long value; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const long *)sptr; if((value >= 0 && value <= 1185)) { /* Constraint check succeeded */ return 0; } else { _ASN_CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } }
/* * Check that the time looks like the time. */ int GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr; time_t tloc; errno = EPERM; /* Just an unlikely error code */ tloc = asn_GT2time(st, 0, 0); if(tloc == -1 && errno != EPERM) { _ASN_CTFAIL(app_key, td, sptr, "%s: Invalid time format: %s (%s:%d)", td->name, strerror(errno), __FILE__, __LINE__); return -1; } return 0; }
static int memb_seconds_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { unsigned long value; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } value = *(const unsigned long *)sptr; /* Constraint check succeeded */ return 0; }
static int memb_value_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } return td->check_constraints(td, sptr, ctfailcb, app_key); }
static int memb_rrcConnectionSetupComplete_r3_add_ext_constraint_12(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } return td->check_constraints(td, sptr, ctfailcb, app_key); }
static int memb_sourceSystemInformationBlockType1Ext_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } return td->check_constraints(td, sptr, ctfailcb, app_key); }
int RANAP_RAB_SetupOrModifyList_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_RANAP_RAB_IE_ContainerPairList.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); }
int PolicyQualifierId_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(1 /* No applicable constraints whatsoever */) { /* Nothing is here. See below */ } /* Replace with underlying type checker */ td->check_constraints = asn_DEF_OBJECT_IDENTIFIER.check_constraints; return td->check_constraints(td, sptr, ctfailcb, app_key); }
int SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { asn_TYPE_member_t *elm = td->elements; asn_constr_check_f *constr; const asn_anonymous_set_ *list = _A_CSET_FROM_VOID(sptr); int i; if(!sptr) { _ASN_CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } constr = elm->memb_constraints; if(!constr) constr = elm->type->check_constraints; /* * Iterate over the members of an array. * Validate each in turn, until one fails. */ for(i = 0; i < list->count; i++) { const void *memb_ptr = list->array[i]; int ret; if(!memb_ptr) continue; ret = constr(elm->type, memb_ptr, ctfailcb, app_key); if(ret) return ret; } /* * Cannot inherit it eralier: * need to make sure we get the updated version. */ if(!elm->memb_constraints) elm->memb_constraints = elm->type->check_constraints; return 0; }
/* * Check that the time looks like the time. */ int GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const GeneralizedTime *st = 0; time_t tloc; if (sptr) { const AsnAbstractType* structPtr = static_cast<const AsnAbstractType*>(sptr); st = static_cast<const GeneralizedTime*>(structPtr); } errno = EPERM; /* Just an unlikely error code */ tloc = st ? st->ToTime(0, 0) : -1; if(tloc == -1 && errno != EPERM) { _ASN_CTFAIL(app_key, td, sptr, "%s: Invalid time format: %s (%s:%d)", td->name, strerror(errno), __FILE__, __LINE__); return -1; } return 0; }