Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
55cc44a4
Commit
55cc44a4
authored
Oct 03, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
additional UTF8 testing
parent
33d5d3c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
144 additions
and
8 deletions
+144
-8
tests/50-constraint-OK.asn1.-P
tests/50-constraint-OK.asn1.-P
+144
-8
No files found.
tests/50-constraint-OK.asn1.-P
View file @
55cc44a4
...
@@ -2283,6 +2283,142 @@ asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
...
@@ -2283,6 +2283,142 @@ asn_TYPE_descriptor_t asn_DEF_Neither_SIZE_nor_FROM = {
};
};
/*** <<< INCLUDES [Utf8-4] >>> ***/
#include <UTF8String.h>
/*** <<< TYPE-DECLS [Utf8-4] >>> ***/
typedef UTF8String_t Utf8_4_t;
/*** <<< FUNC-DECLS [Utf8-4] >>> ***/
extern asn_TYPE_descriptor_t asn_DEF_Utf8_4;
asn_struct_free_f Utf8_4_free;
asn_struct_print_f Utf8_4_print;
asn_constr_check_f Utf8_4_constraint;
ber_type_decoder_f Utf8_4_decode_ber;
der_type_encoder_f Utf8_4_encode_der;
xer_type_encoder_f Utf8_4_encode_xer;
/*** <<< CTABLES [Utf8-4] >>> ***/
static int check_permitted_alphabet_12(const void *sptr) {
if(UTF8String_length((const UTF8String_t *)sptr) < 0)
return -1; /* Alphabet (sic!) test failed. */
return 0;
}
/*** <<< CODE [Utf8-4] >>> ***/
int
Utf8_4_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const UTF8String_t *st = sptr;
if(!sptr) {
_ASN_ERRLOG(app_errlog, app_key,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
if(!check_permitted_alphabet_12(sptr)) {
/* Constraint check succeeded */
return 0;
} else {
_ASN_ERRLOG(app_errlog, app_key,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
/*
* This type is implemented using UTF8String,
* so here we adjust the DEF accordingly.
*/
static void
Utf8_4_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_UTF8String.free_struct;
td->print_struct = asn_DEF_UTF8String.print_struct;
td->ber_decoder = asn_DEF_UTF8String.ber_decoder;
td->der_encoder = asn_DEF_UTF8String.der_encoder;
td->xer_decoder = asn_DEF_UTF8String.xer_decoder;
td->xer_encoder = asn_DEF_UTF8String.xer_encoder;
td->elements = asn_DEF_UTF8String.elements;
td->elements_count = asn_DEF_UTF8String.elements_count;
td->specifics = asn_DEF_UTF8String.specifics;
}
void
Utf8_4_free(asn_TYPE_descriptor_t *td,
void *struct_ptr, int contents_only) {
Utf8_4_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only);
}
int
Utf8_4_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Utf8_4_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
ber_dec_rval_t
Utf8_4_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, void *bufptr, size_t size, int tag_mode) {
Utf8_4_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}
asn_enc_rval_t
Utf8_4_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) {
Utf8_4_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}
asn_enc_rval_t
Utf8_4_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) {
Utf8_4_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}
/*** <<< STAT-DEFS [Utf8-4] >>> ***/
static ber_tlv_tag_t asn_DEF_Utf8_4_tags[] = {
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Utf8_4 = {
"Utf8-4",
Utf8_4_free,
Utf8_4_print,
Utf8_4_constraint,
Utf8_4_decode_ber,
Utf8_4_encode_der,
0, /* Not implemented yet */
Utf8_4_encode_xer,
0, /* Use generic outmost tag fetcher */
asn_DEF_Utf8_4_tags,
sizeof(asn_DEF_Utf8_4_tags)
/sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */
asn_DEF_Utf8_4_tags, /* Same as above */
sizeof(asn_DEF_Utf8_4_tags)
/sizeof(asn_DEF_Utf8_4_tags[0]), /* 1 */
0, 0, /* No members */
0 /* No specifics */
};
/*** <<< INCLUDES [Utf8-3] >>> ***/
/*** <<< INCLUDES [Utf8-3] >>> ***/
#include <Utf8-2.h>
#include <Utf8-2.h>
...
@@ -2304,7 +2440,7 @@ xer_type_encoder_f Utf8_3_encode_xer;
...
@@ -2304,7 +2440,7 @@ xer_type_encoder_f Utf8_3_encode_xer;
/*** <<< CTABLES [Utf8-3] >>> ***/
/*** <<< CTABLES [Utf8-3] >>> ***/
static int permitted_alphabet_table_1
2
[128] = {
static int permitted_alphabet_table_1
3
[128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
...
@@ -2315,8 +2451,8 @@ static int permitted_alphabet_table_12[128] = {
...
@@ -2315,8 +2451,8 @@ static int permitted_alphabet_table_12[128] = {
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
};
};
static int check_permitted_alphabet_1
2
(const void *sptr) {
static int check_permitted_alphabet_1
3
(const void *sptr) {
int *table = permitted_alphabet_table_1
2
;
int *table = permitted_alphabet_table_1
3
;
/* The underlying type is UTF8String */
/* The underlying type is UTF8String */
const UTF8String_t *st = sptr;
const UTF8String_t *st = sptr;
const uint8_t *ch = st->buf;
const uint8_t *ch = st->buf;
...
@@ -2355,7 +2491,7 @@ Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
...
@@ -2355,7 +2491,7 @@ Utf8_3_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
}
}
if((size >= 1 && size <= 2)
if((size >= 1 && size <= 2)
&& !check_permitted_alphabet_1
2
(sptr)) {
&& !check_permitted_alphabet_1
3
(sptr)) {
/* Constraint check succeeded */
/* Constraint check succeeded */
return 0;
return 0;
} else {
} else {
...
@@ -2640,7 +2776,7 @@ xer_type_encoder_f Identifier_encode_xer;
...
@@ -2640,7 +2776,7 @@ xer_type_encoder_f Identifier_encode_xer;
/*** <<< CTABLES [Identifier] >>> ***/
/*** <<< CTABLES [Identifier] >>> ***/
static int permitted_alphabet_table_1
4
[256] = {
static int permitted_alphabet_table_1
5
[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* */
0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0, /* $ */
...
@@ -2651,8 +2787,8 @@ static int permitted_alphabet_table_14[256] = {
...
@@ -2651,8 +2787,8 @@ static int permitted_alphabet_table_14[256] = {
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, /* pqrstuvwxyz */
};
};
static int check_permitted_alphabet_1
4
(const void *sptr) {
static int check_permitted_alphabet_1
5
(const void *sptr) {
int *table = permitted_alphabet_table_1
4
;
int *table = permitted_alphabet_table_1
5
;
/* The underlying type is VisibleString */
/* The underlying type is VisibleString */
const VisibleString_t *st = sptr;
const VisibleString_t *st = sptr;
const uint8_t *ch = st->buf;
const uint8_t *ch = st->buf;
...
@@ -2684,7 +2820,7 @@ Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
...
@@ -2684,7 +2820,7 @@ Identifier_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
size = st->size;
size = st->size;
if((size >= 1 && size <= 32)
if((size >= 1 && size <= 32)
&& !check_permitted_alphabet_1
4
(sptr)) {
&& !check_permitted_alphabet_1
5
(sptr)) {
/* Constraint check succeeded */
/* Constraint check succeeded */
return 0;
return 0;
} else {
} else {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment