mirror of https://gerrit.osmocom.org/asn1c
constraint fail message
parent
4902f05440
commit
ed9019a9e4
|
@ -51,13 +51,13 @@ BIT_STRING_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
|
||||
if(st && st->buf) {
|
||||
if(st->size == 1 && st->bits_unused) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: invalid padding byte (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -190,7 +190,7 @@ GeneralizedTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
errno = EPERM; /* Just an unlikely error code */
|
||||
tloc = asn_GT2time(st, 0, 0);
|
||||
if(tloc == -1 && errno != EPERM) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: Invalid time format: %s (%s:%d)",
|
||||
td->name, strerror(errno), __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -55,7 +55,7 @@ IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
*/
|
||||
for(; buf < end; buf++) {
|
||||
if(*buf > 0x7F) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value byte %ld out of range: "
|
||||
"%d > 127 (%s:%d)",
|
||||
td->name,
|
||||
|
@ -66,7 +66,7 @@ IA5String_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -81,7 +81,7 @@ NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
case 0x35: case 0x36: case 0x37: case 0x38: case 0x39:
|
||||
continue;
|
||||
}
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value byte %ld (%d) "
|
||||
"not in NumericString alphabet (%s:%d)",
|
||||
td->name,
|
||||
|
@ -91,7 +91,7 @@ NumericString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
return -1;
|
||||
}
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -46,14 +46,14 @@ OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
|
||||
if(st && st->buf) {
|
||||
if(st->size < 1) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: at least one numerical value "
|
||||
"expected (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -87,7 +87,7 @@ PrintableString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
*/
|
||||
for(; buf < end; buf++) {
|
||||
if(!_PrintableString_alphabet[*buf]) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value byte %ld (%d) "
|
||||
"not in PrintableString alphabet "
|
||||
"(%s:%d)",
|
||||
|
@ -99,7 +99,7 @@ PrintableString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -66,7 +66,7 @@ UTCTime_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
errno = EPERM; /* Just an unlikely error code */
|
||||
tloc = asn_UT2time(st, 0, 0);
|
||||
if(tloc == -1 && errno != EPERM) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: Invalid time format: %s (%s:%d)",
|
||||
td->name, strerror(errno), __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -73,26 +73,26 @@ UTF8String_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
ssize_t len = UTF8String_length((const UTF8String_t *)sptr);
|
||||
switch(len) {
|
||||
case U8E_EINVAL:
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given", td->name);
|
||||
break;
|
||||
case U8E_TRUNC:
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: truncated UTF-8 sequence (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
break;
|
||||
case U8E_ILLSTART:
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8 illegal start of encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
break;
|
||||
case U8E_NOTCONT:
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8 not continuation (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
break;
|
||||
case U8E_NOTMIN:
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8 not minimal sequence (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
break;
|
||||
|
|
|
@ -58,7 +58,7 @@ VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
*/
|
||||
for(; buf < end; buf++) {
|
||||
if(*buf < 0x20 || *buf > 0x7e) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value byte %ld (%d) "
|
||||
"not in VisibleString alphabet (%s:%d)",
|
||||
td->name,
|
||||
|
@ -69,7 +69,7 @@ VisibleString_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -482,7 +482,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
int present;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
@ -501,7 +501,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
if(!memb_ptr) {
|
||||
if(elm->optional)
|
||||
return 0;
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: mandatory CHOICE element %s absent (%s:%d)",
|
||||
td->name, elm->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
@ -524,7 +524,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
return ret;
|
||||
}
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: no CHOICE element given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -980,7 +980,7 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
int edx;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
@ -998,7 +998,7 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
if(!memb_ptr) {
|
||||
if(elm->optional)
|
||||
continue;
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: mandatory element %s absent (%s:%d)",
|
||||
td->name, elm->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -945,7 +945,7 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
int edx;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
@ -963,7 +963,7 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
if(!memb_ptr) {
|
||||
if(elm->optional)
|
||||
continue;
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: mandatory element %s absent (%s:%d)",
|
||||
td->name, elm->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
|
@ -819,7 +819,7 @@ SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
|||
int i;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td,
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in New Issue