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
5e03376b
Commit
5e03376b
authored
Sep 29, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asn1_* renamed into asn_*
parent
c4e4b684
Changes
79
Hide whitespace changes
Inline
Side-by-side
Showing
79 changed files
with
466 additions
and
462 deletions
+466
-462
skeletons/ANY.c
skeletons/ANY.c
+6
-6
skeletons/ANY.h
skeletons/ANY.h
+5
-5
skeletons/BIT_STRING.c
skeletons/BIT_STRING.c
+12
-12
skeletons/BIT_STRING.h
skeletons/BIT_STRING.h
+1
-1
skeletons/BMPString.c
skeletons/BMPString.c
+10
-10
skeletons/BMPString.h
skeletons/BMPString.h
+1
-1
skeletons/BOOLEAN.c
skeletons/BOOLEAN.c
+14
-12
skeletons/BOOLEAN.h
skeletons/BOOLEAN.h
+1
-1
skeletons/ENUMERATED.c
skeletons/ENUMERATED.c
+6
-6
skeletons/ENUMERATED.h
skeletons/ENUMERATED.h
+1
-1
skeletons/GeneralString.c
skeletons/GeneralString.c
+8
-8
skeletons/GeneralString.h
skeletons/GeneralString.h
+1
-1
skeletons/GeneralizedTime.c
skeletons/GeneralizedTime.c
+15
-15
skeletons/GeneralizedTime.h
skeletons/GeneralizedTime.h
+2
-2
skeletons/GraphicString.c
skeletons/GraphicString.c
+8
-8
skeletons/GraphicString.h
skeletons/GraphicString.h
+1
-1
skeletons/IA5String.c
skeletons/IA5String.c
+9
-9
skeletons/IA5String.h
skeletons/IA5String.h
+1
-1
skeletons/INTEGER.c
skeletons/INTEGER.c
+12
-12
skeletons/INTEGER.h
skeletons/INTEGER.h
+2
-2
skeletons/ISO646String.c
skeletons/ISO646String.c
+8
-8
skeletons/ISO646String.h
skeletons/ISO646String.h
+1
-1
skeletons/NULL.c
skeletons/NULL.c
+9
-9
skeletons/NULL.h
skeletons/NULL.h
+1
-1
skeletons/NativeEnumerated.c
skeletons/NativeEnumerated.c
+6
-6
skeletons/NativeEnumerated.h
skeletons/NativeEnumerated.h
+1
-1
skeletons/NativeInteger.c
skeletons/NativeInteger.c
+15
-13
skeletons/NativeInteger.h
skeletons/NativeInteger.h
+1
-1
skeletons/NativeReal.c
skeletons/NativeReal.c
+16
-14
skeletons/NativeReal.h
skeletons/NativeReal.h
+1
-1
skeletons/NumericString.c
skeletons/NumericString.c
+9
-9
skeletons/NumericString.h
skeletons/NumericString.h
+1
-1
skeletons/OBJECT_IDENTIFIER.c
skeletons/OBJECT_IDENTIFIER.c
+11
-11
skeletons/OBJECT_IDENTIFIER.h
skeletons/OBJECT_IDENTIFIER.h
+1
-1
skeletons/OCTET_STRING.h
skeletons/OCTET_STRING.h
+2
-2
skeletons/ObjectDescriptor.c
skeletons/ObjectDescriptor.c
+8
-8
skeletons/ObjectDescriptor.h
skeletons/ObjectDescriptor.h
+1
-1
skeletons/PrintableString.c
skeletons/PrintableString.c
+9
-9
skeletons/PrintableString.h
skeletons/PrintableString.h
+1
-1
skeletons/REAL.c
skeletons/REAL.c
+12
-12
skeletons/REAL.h
skeletons/REAL.h
+3
-3
skeletons/RELATIVE-OID.c
skeletons/RELATIVE-OID.c
+10
-10
skeletons/RELATIVE-OID.h
skeletons/RELATIVE-OID.h
+1
-1
skeletons/T61String.c
skeletons/T61String.c
+8
-8
skeletons/T61String.h
skeletons/T61String.h
+1
-1
skeletons/TeletexString.c
skeletons/TeletexString.c
+8
-8
skeletons/TeletexString.h
skeletons/TeletexString.h
+1
-1
skeletons/UTCTime.c
skeletons/UTCTime.c
+11
-11
skeletons/UTCTime.h
skeletons/UTCTime.h
+1
-1
skeletons/UTF8String.c
skeletons/UTF8String.c
+10
-10
skeletons/UTF8String.h
skeletons/UTF8String.h
+1
-1
skeletons/UniversalString.c
skeletons/UniversalString.c
+10
-10
skeletons/UniversalString.h
skeletons/UniversalString.h
+1
-1
skeletons/VideotexString.c
skeletons/VideotexString.c
+8
-8
skeletons/VideotexString.h
skeletons/VideotexString.h
+1
-1
skeletons/VisibleString.h
skeletons/VisibleString.h
+1
-1
skeletons/asn_application.h
skeletons/asn_application.h
+1
-1
skeletons/ber_codec_prim.c
skeletons/ber_codec_prim.c
+6
-4
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+31
-32
skeletons/constr_CHOICE.h
skeletons/constr_CHOICE.h
+3
-3
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+24
-25
skeletons/constr_SEQUENCE.h
skeletons/constr_SEQUENCE.h
+4
-4
skeletons/constr_SEQUENCE_OF.c
skeletons/constr_SEQUENCE_OF.c
+5
-5
skeletons/constr_SET.c
skeletons/constr_SET.c
+25
-26
skeletons/constr_SET.h
skeletons/constr_SET.h
+4
-4
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+20
-21
skeletons/constr_SET_OF.h
skeletons/constr_SET_OF.h
+3
-3
skeletons/constr_TYPE.c
skeletons/constr_TYPE.c
+2
-2
skeletons/constraints.c
skeletons/constraints.c
+3
-3
skeletons/constraints.h
skeletons/constraints.h
+3
-3
skeletons/der_encoder.c
skeletons/der_encoder.c
+2
-2
skeletons/der_encoder.h
skeletons/der_encoder.h
+4
-4
skeletons/tests/check-GeneralizedTime.c
skeletons/tests/check-GeneralizedTime.c
+2
-2
skeletons/tests/check-INTEGER.c
skeletons/tests/check-INTEGER.c
+2
-2
skeletons/tests/check-OIDs.c
skeletons/tests/check-OIDs.c
+4
-4
skeletons/tests/check-REAL.c
skeletons/tests/check-REAL.c
+4
-4
skeletons/tests/check-UTCTime.c
skeletons/tests/check-UTCTime.c
+2
-2
skeletons/xer_encoder.c
skeletons/xer_encoder.c
+2
-2
skeletons/xer_encoder.h
skeletons/xer_encoder.h
+4
-4
No files found.
skeletons/ANY.c
View file @
5e03376b
...
...
@@ -7,7 +7,7 @@
#include <assert.h>
#include <errno.h>
asn
1_TYPE_descriptor_t
asn1
_DEF_ANY
=
{
asn
_TYPE_descriptor_t
asn
_DEF_ANY
=
{
"ANY"
,
OCTET_STRING_free
,
OCTET_STRING_print
,
...
...
@@ -24,7 +24,7 @@ asn1_TYPE_descriptor_t asn1_DEF_ANY = {
asn_enc_rval_t
ANY_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
ANY_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
...
...
@@ -48,7 +48,7 @@ struct _callback_arg {
static
int
ANY__consume_bytes
(
const
void
*
buffer
,
size_t
size
,
void
*
key
);
int
ANY_fromType
(
ANY_t
*
st
,
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
ANY_fromType
(
ANY_t
*
st
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
struct
_callback_arg
arg
;
asn_enc_rval_t
erval
;
...
...
@@ -81,7 +81,7 @@ ANY_fromType(ANY_t *st, asn1_TYPE_descriptor_t *td, void *sptr) {
}
ANY_t
*
ANY_new_fromType
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
ANY_new_fromType
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
ANY_t
tmp
;
ANY_t
*
st
;
...
...
@@ -105,7 +105,7 @@ ANY_new_fromType(asn1_TYPE_descriptor_t *td, void *sptr) {
}
int
ANY_to_type
(
ANY_t
*
st
,
asn
1
_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
)
{
ANY_to_type
(
ANY_t
*
st
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
)
{
ber_dec_rval_t
rval
;
void
*
newst
=
0
;
...
...
@@ -120,7 +120,7 @@ ANY_to_type(ANY_t *st, asn1_TYPE_descriptor_t *td, void **struct_ptr) {
return
0
;
}
rval
=
ber_decode
(
td
,
(
void
**
)
&
newst
,
st
->
buf
,
st
->
size
);
rval
=
ber_decode
(
0
,
td
,
(
void
**
)
&
newst
,
st
->
buf
,
st
->
size
);
if
(
rval
.
code
==
RC_OK
)
{
*
struct_ptr
=
newst
;
return
0
;
...
...
skeletons/ANY.h
View file @
5e03376b
...
...
@@ -11,10 +11,10 @@ typedef struct ANY {
uint8_t
*
buf
;
/* BER-encoded ANY contents */
int
size
;
/* Size of the above buffer */
ber_dec_ctx_t
_ber_dec
_ctx
;
/* Parsing across buffer boundaries */
asn_struct_ctx_t
_asn
_ctx
;
/* Parsing across buffer boundaries */
}
ANY_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_ANY
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_ANY
;
asn_struct_free_f
ANY_free
;
asn_struct_print_f
ANY_print
;
...
...
@@ -27,11 +27,11 @@ xer_type_encoder_f ANY_encode_xer;
******************************/
/* Convert another ASN.1 type into the ANY. This implies DER encoding. */
int
ANY_fromType
(
ANY_t
*
,
asn
1
_TYPE_descriptor_t
*
td
,
void
*
struct_ptr
);
ANY_t
*
ANY_new_fromType
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
struct_ptr
);
int
ANY_fromType
(
ANY_t
*
,
asn_TYPE_descriptor_t
*
td
,
void
*
struct_ptr
);
ANY_t
*
ANY_new_fromType
(
asn_TYPE_descriptor_t
*
td
,
void
*
struct_ptr
);
/* Convert the contents of the ANY type into the specified type. */
int
ANY_to_type
(
ANY_t
*
,
asn
1
_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
);
int
ANY_to_type
(
ANY_t
*
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
);
#define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
#define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf((buf), (size))
...
...
skeletons/BIT_STRING.c
View file @
5e03376b
...
...
@@ -9,10 +9,10 @@
/*
* BIT STRING basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_BIT_STRING_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_BIT_STRING_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
3
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_BIT_STRING
=
{
asn
_TYPE_descriptor_t
asn
_DEF_BIT_STRING
=
{
"BIT STRING"
,
OCTET_STRING_free
,
/* Implemented in terms of OCTET STRING */
BIT_STRING_print
,
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_BIT_STRING = {
0
,
/* Not implemented yet */
BIT_STRING_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_BIT_STRING_tags
,
sizeof
(
asn
1
_DEF_BIT_STRING_tags
)
/
sizeof
(
asn
1
_DEF_BIT_STRING_tags
[
0
]),
asn
1
_DEF_BIT_STRING_tags
,
/* Same as above */
sizeof
(
asn
1
_DEF_BIT_STRING_tags
)
/
sizeof
(
asn
1
_DEF_BIT_STRING_tags
[
0
]),
asn_DEF_BIT_STRING_tags
,
sizeof
(
asn_DEF_BIT_STRING_tags
)
/
sizeof
(
asn_DEF_BIT_STRING_tags
[
0
]),
asn_DEF_BIT_STRING_tags
,
/* Same as above */
sizeof
(
asn_DEF_BIT_STRING_tags
)
/
sizeof
(
asn_DEF_BIT_STRING_tags
[
0
]),
0
,
0
,
/* No members */
(
void
*
)
1
/* Special indicator that this is a BIT STRING */
};
...
...
@@ -36,7 +36,7 @@ asn1_TYPE_descriptor_t asn1_DEF_BIT_STRING = {
* BIT STRING generic constraint.
*/
int
BIT_STRING_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
BIT_STRING_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
const
BIT_STRING_t
*
st
=
(
const
BIT_STRING_t
*
)
sptr
;
...
...
@@ -70,7 +70,7 @@ static char *_bit_pattern[16] = {
};
asn_enc_rval_t
BIT_STRING_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
BIT_STRING_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
...
...
@@ -118,7 +118,7 @@ BIT_STRING_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
int
mbit
=
st
->
buf
[
0
];
/* bits to skip from the right */
int
i
;
for
(
i
=
7
;
i
>=
mbit
;
i
--
)
*
p
++
=
(
v
&
(
1
<<
i
))
?
'1'
:
'0'
;
*
p
++
=
(
v
&
(
1
<<
i
))
?
0x31
:
0x30
;
er
.
encoded
+=
p
-
scratch
;
_ASN_CALLBACK
(
scratch
,
p
-
scratch
);
}
...
...
@@ -133,7 +133,7 @@ BIT_STRING_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
* BIT STRING specific contents printer.
*/
int
BIT_STRING_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
BIT_STRING_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
static
const
char
*
h2c
=
"0123456789ABCDEF"
;
char
scratch
[
64
];
...
...
skeletons/BIT_STRING.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
BIT_STRING_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_BIT_STRING
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_BIT_STRING
;
asn_struct_print_f
BIT_STRING_print
;
/* Human-readable output */
asn_constr_check_f
BIT_STRING_constraint
;
...
...
skeletons/BMPString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* BMPString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_BMPString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_BMPString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
30
<<
2
)),
/* [UNIVERSAL 30] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_BMPString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_BMPString
=
{
"BMPString"
,
OCTET_STRING_free
,
/* Implemented in terms of OCTET STRING */
BMPString_print
,
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_BMPString = {
0
,
/* Not implemented yet */
BMPString_encode_xer
,
/* Conver to UTF8 */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_BMPString_tags
,
sizeof
(
asn
1
_DEF_BMPString_tags
)
/
sizeof
(
asn
1
_DEF_BMPString_tags
[
0
])
-
1
,
asn
1
_DEF_BMPString_tags
,
sizeof
(
asn
1
_DEF_BMPString_tags
)
/
sizeof
(
asn
1
_DEF_BMPString_tags
[
0
]),
asn_DEF_BMPString_tags
,
sizeof
(
asn_DEF_BMPString_tags
)
/
sizeof
(
asn_DEF_BMPString_tags
[
0
])
-
1
,
asn_DEF_BMPString_tags
,
sizeof
(
asn_DEF_BMPString_tags
)
/
sizeof
(
asn_DEF_BMPString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -74,7 +74,7 @@ BMPString__dump(const BMPString_t *st,
}
asn_enc_rval_t
BMPString_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
BMPString_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
BMPString_t
*
st
=
(
const
BMPString_t
*
)
sptr
;
...
...
@@ -93,7 +93,7 @@ BMPString_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
BMPString_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
BMPString_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
BMPString_t
*
st
=
(
const
BMPString_t
*
)
sptr
;
...
...
skeletons/BMPString.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
BMPString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_BMPString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_BMPString
;
asn_struct_print_f
BMPString_print
;
/* Human-readable output */
xer_type_encoder_f
BMPString_encode_xer
;
...
...
skeletons/BOOLEAN.c
View file @
5e03376b
...
...
@@ -8,10 +8,10 @@
/*
* BOOLEAN basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_BOOLEAN_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_BOOLEAN_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
1
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_BOOLEAN
=
{
asn
_TYPE_descriptor_t
asn
_DEF_BOOLEAN
=
{
"BOOLEAN"
,
BOOLEAN_free
,
BOOLEAN_print
,
...
...
@@ -21,10 +21,10 @@ asn1_TYPE_descriptor_t asn1_DEF_BOOLEAN = {
0
,
/* Not implemented yet */
BOOLEAN_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_BOOLEAN_tags
,
sizeof
(
asn
1_DEF_BOOLEAN_tags
)
/
sizeof
(
asn1
_DEF_BOOLEAN_tags
[
0
]),
asn
1
_DEF_BOOLEAN_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_BOOLEAN_tags
)
/
sizeof
(
asn1
_DEF_BOOLEAN_tags
[
0
]),
asn_DEF_BOOLEAN_tags
,
sizeof
(
asn
_DEF_BOOLEAN_tags
)
/
sizeof
(
asn
_DEF_BOOLEAN_tags
[
0
]),
asn_DEF_BOOLEAN_tags
,
/* Same as above */
sizeof
(
asn
_DEF_BOOLEAN_tags
)
/
sizeof
(
asn
_DEF_BOOLEAN_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -33,7 +33,8 @@ asn1_TYPE_descriptor_t asn1_DEF_BOOLEAN = {
* Decode BOOLEAN type.
*/
ber_dec_rval_t
BOOLEAN_decode_ber
(
asn1_TYPE_descriptor_t
*
td
,
BOOLEAN_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
bool_value
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
BOOLEAN_t
*
st
=
(
BOOLEAN_t
*
)
*
bool_value
;
...
...
@@ -56,7 +57,8 @@ BOOLEAN_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Check tags.
*/
rval
=
ber_check_tags
(
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
if
(
rval
.
code
!=
RC_OK
)
return
rval
;
...
...
@@ -94,7 +96,7 @@ BOOLEAN_decode_ber(asn1_TYPE_descriptor_t *td,
}
asn_enc_rval_t
BOOLEAN_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
BOOLEAN_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
erval
;
...
...
@@ -126,7 +128,7 @@ BOOLEAN_encode_der(asn1_TYPE_descriptor_t *td, void *sptr,
}
asn_enc_rval_t
BOOLEAN_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
BOOLEAN_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
BOOLEAN_t
*
st
=
(
const
BOOLEAN_t
*
)
sptr
;
...
...
@@ -149,7 +151,7 @@ BOOLEAN_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
BOOLEAN_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
BOOLEAN_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
BOOLEAN_t
*
st
=
(
const
BOOLEAN_t
*
)
sptr
;
const
char
*
buf
;
...
...
@@ -175,7 +177,7 @@ BOOLEAN_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
void
BOOLEAN_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
BOOLEAN_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
if
(
td
&&
ptr
&&
!
contents_only
)
{
FREEMEM
(
ptr
);
}
...
...
skeletons/BOOLEAN.h
View file @
5e03376b
...
...
@@ -14,7 +14,7 @@
*/
typedef
int
BOOLEAN_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_BOOLEAN
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_BOOLEAN
;
asn_struct_free_f
BOOLEAN_free
;
asn_struct_print_f
BOOLEAN_print
;
...
...
skeletons/ENUMERATED.c
View file @
5e03376b
...
...
@@ -9,10 +9,10 @@
/*
* ENUMERATED basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_ENUMERATED_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_ENUMERATED_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
10
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_ENUMERATED
=
{
asn
_TYPE_descriptor_t
asn
_DEF_ENUMERATED
=
{
"ENUMERATED"
,
ASN__PRIMITIVE_TYPE_free
,
INTEGER_print
,
/* Implemented in terms of INTEGER */
...
...
@@ -22,10 +22,10 @@ asn1_TYPE_descriptor_t asn1_DEF_ENUMERATED = {
0
,
/* Not implemented yet */
INTEGER_encode_xer
,
/* Implemented in terms of INTEGER */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_ENUMERATED_tags
,
sizeof
(
asn
1_DEF_ENUMERATED_tags
)
/
sizeof
(
asn1
_DEF_ENUMERATED_tags
[
0
]),
asn
1
_DEF_ENUMERATED_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_ENUMERATED_tags
)
/
sizeof
(
asn1
_DEF_ENUMERATED_tags
[
0
]),
asn_DEF_ENUMERATED_tags
,
sizeof
(
asn
_DEF_ENUMERATED_tags
)
/
sizeof
(
asn
_DEF_ENUMERATED_tags
[
0
]),
asn_DEF_ENUMERATED_tags
,
/* Same as above */
sizeof
(
asn
_DEF_ENUMERATED_tags
)
/
sizeof
(
asn
_DEF_ENUMERATED_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/ENUMERATED.h
View file @
5e03376b
...
...
@@ -9,6 +9,6 @@
typedef
INTEGER_t
ENUMERATED_t
;
/* Implemented via INTEGER */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_ENUMERATED
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_ENUMERATED
;
#endif
/* _ENUMERATED_H_ */
skeletons/GeneralString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* GeneralString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_GeneralString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_GeneralString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
27
<<
2
)),
/* [UNIVERSAL 27] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_GeneralString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_GeneralString
=
{
"GeneralString"
,
OCTET_STRING_free
,
OCTET_STRING_print
,
/* non-ascii string */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_GeneralString = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_GeneralString_tags
,
sizeof
(
asn
1
_DEF_GeneralString_tags
)
/
sizeof
(
asn
1
_DEF_GeneralString_tags
[
0
])
-
1
,
asn
1
_DEF_GeneralString_tags
,
sizeof
(
asn
1
_DEF_GeneralString_tags
)
/
sizeof
(
asn
1
_DEF_GeneralString_tags
[
0
]),
asn_DEF_GeneralString_tags
,
sizeof
(
asn_DEF_GeneralString_tags
)
/
sizeof
(
asn_DEF_GeneralString_tags
[
0
])
-
1
,
asn_DEF_GeneralString_tags
,
sizeof
(
asn_DEF_GeneralString_tags
)
/
sizeof
(
asn_DEF_GeneralString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/GeneralString.h
View file @
5e03376b
...
...
@@ -9,6 +9,6 @@
typedef
OCTET_STRING_t
GeneralString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_GeneralString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_GeneralString
;
#endif
/* _GeneralString_H_ */
skeletons/GeneralizedTime.c
View file @
5e03376b
...
...
@@ -109,12 +109,12 @@ static time_t timegm(struct tm *tm) {
/*
* GeneralizedTime basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_GeneralizedTime_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_GeneralizedTime_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
24
<<
2
)),
/* [UNIVERSAL 24] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
26
<<
2
)),
/* [UNIVERSAL 26] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_GeneralizedTime
=
{
asn
_TYPE_descriptor_t
asn
_DEF_GeneralizedTime
=
{
"GeneralizedTime"
,
OCTET_STRING_free
,
GeneralizedTime_print
,
...
...
@@ -124,12 +124,12 @@ asn1_TYPE_descriptor_t asn1_DEF_GeneralizedTime = {
0
,
/* Not implemented yet */
GeneralizedTime_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_GeneralizedTime_tags
,
sizeof
(
asn
1
_DEF_GeneralizedTime_tags
)
/
sizeof
(
asn
1
_DEF_GeneralizedTime_tags
[
0
])
-
2
,
asn
1
_DEF_GeneralizedTime_tags
,
sizeof
(
asn
1
_DEF_GeneralizedTime_tags
)
/
sizeof
(
asn
1
_DEF_GeneralizedTime_tags
[
0
]),
asn_DEF_GeneralizedTime_tags
,
sizeof
(
asn_DEF_GeneralizedTime_tags
)
/
sizeof
(
asn_DEF_GeneralizedTime_tags
[
0
])
-
2
,
asn_DEF_GeneralizedTime_tags
,
sizeof
(
asn_DEF_GeneralizedTime_tags
)
/
sizeof
(
asn_DEF_GeneralizedTime_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -140,7 +140,7 @@ asn1_TYPE_descriptor_t asn1_DEF_GeneralizedTime = {
* Check that the time looks like the time.
*/
int
GeneralizedTime_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
GeneralizedTime_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
const
GeneralizedTime_t
*
st
=
(
const
GeneralizedTime_t
*
)
sptr
;
time_t
tloc
;
...
...
@@ -158,14 +158,14 @@ GeneralizedTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
}
asn_enc_rval_t
GeneralizedTime_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
GeneralizedTime_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
GeneralizedTime_t
*
st
=
(
GeneralizedTime_t
*
)
ptr
;
asn_enc_rval_t
erval
;
/* If not canonical DER, re-encode into canonical DER. */
if
(
st
->
size
&&
st
->
buf
[
st
->
size
-
1
]
!=
'Z'
)
{
if
(
st
->
size
&&
st
->
buf
[
st
->
size
-
1
]
!=
0x5a
)
{
struct
tm
tm
;
time_t
tloc
;
...
...
@@ -199,7 +199,7 @@ GeneralizedTime_encode_der(asn1_TYPE_descriptor_t *td, void *ptr,
}
asn_enc_rval_t
GeneralizedTime_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
GeneralizedTime_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
OCTET_STRING_t
st
;
...
...
@@ -229,7 +229,7 @@ GeneralizedTime_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
GeneralizedTime_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
GeneralizedTime_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
GeneralizedTime_t
*
st
=
(
const
GeneralizedTime_t
*
)
sptr
;
...
...
@@ -445,7 +445,7 @@ local_finish:
tloc
=
timegm
(
&
tm_s
);
}
else
{
/*
* Without an offset (or
'Z'
),
* Without an offset (or
"Z"
),
* we can only guess that it is a local zone.
* Interpret it in this fashion.
*/
...
...
@@ -523,7 +523,7 @@ asn_time2GT(GeneralizedTime_t *opt_gt, const struct tm *tm, int force_gmt) {
p
=
buf
+
size
;
if
(
force_gmt
)
{
*
p
++
=
0x5a
;
/*
'Z'
*/
*
p
++
=
0x5a
;
/*
"Z"
*/
*
p
++
=
0
;
size
++
;
}
else
{
...
...
skeletons/GeneralizedTime.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
GeneralizedTime_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_GeneralizedTime
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_GeneralizedTime
;
asn_struct_print_f
GeneralizedTime_print
;
asn_constr_check_f
GeneralizedTime_constraint
;
...
...
@@ -36,7 +36,7 @@ time_t asn_GT2time(const GeneralizedTime_t *, struct tm *_optional_tm4fill,
* Convert a struct tm into GeneralizedTime.
* If __opt_gt is not given, this function will try to allocate one.
* If force_gmt is given, the resulting GeneralizedTime will be forced
* into a GMT time zone (encoding ends with
'Z'
).
* into a GMT time zone (encoding ends with
a "Z"
).
* On error, this function returns 0 and sets errno.
*/
GeneralizedTime_t
*
asn_time2GT
(
GeneralizedTime_t
*
__opt_gt
,
const
struct
tm
*
,
...
...
skeletons/GraphicString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* GraphicString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_GraphicString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_GraphicString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
25
<<
2
)),
/* [UNIVERSAL 25] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_GraphicString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_GraphicString
=
{
"GraphicString"
,
OCTET_STRING_free
,
OCTET_STRING_print
,
/* non-ascii string */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_GraphicString = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_GraphicString_tags
,
sizeof
(
asn
1
_DEF_GraphicString_tags
)
/
sizeof
(
asn
1
_DEF_GraphicString_tags
[
0
])
-
1
,
asn
1
_DEF_GraphicString_tags
,
sizeof
(
asn
1
_DEF_GraphicString_tags
)
/
sizeof
(
asn
1
_DEF_GraphicString_tags
[
0
]),
asn_DEF_GraphicString_tags
,
sizeof
(
asn_DEF_GraphicString_tags
)
/
sizeof
(
asn_DEF_GraphicString_tags
[
0
])
-
1
,
asn_DEF_GraphicString_tags
,
sizeof
(
asn_DEF_GraphicString_tags
)
/
sizeof
(
asn_DEF_GraphicString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/GraphicString.h
View file @
5e03376b
...
...
@@ -9,6 +9,6 @@
typedef
OCTET_STRING_t
GraphicString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_GraphicString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_GraphicString
;
#endif
/* _GraphicString_H_ */
skeletons/IA5String.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* IA5String basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_IA5String_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_IA5String_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
22
<<
2
)),
/* [UNIVERSAL 22] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_IA5String
=
{
asn
_TYPE_descriptor_t
asn
_DEF_IA5String
=
{
"IA5String"
,
OCTET_STRING_free
,
OCTET_STRING_print_ascii
,
/* ASCII subset */
...
...
@@ -22,18 +22,18 @@ asn1_TYPE_descriptor_t asn1_DEF_IA5String = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer_ascii
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_IA5String_tags
,
sizeof
(
asn
1
_DEF_IA5String_tags
)
/
sizeof
(
asn
1
_DEF_IA5String_tags
[
0
])
-
1
,
asn
1
_DEF_IA5String_tags
,
sizeof
(
asn
1
_DEF_IA5String_tags
)
/
sizeof
(
asn
1
_DEF_IA5String_tags
[
0
]),
asn_DEF_IA5String_tags
,
sizeof
(
asn_DEF_IA5String_tags
)
/
sizeof
(
asn_DEF_IA5String_tags
[
0
])
-
1
,
asn_DEF_IA5String_tags
,
sizeof
(
asn_DEF_IA5String_tags
)
/
sizeof
(
asn_DEF_IA5String_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
int
IA5String_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
IA5String_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
const
IA5String_t
*
st
=
(
const
IA5String_t
*
)
sptr
;
...
...
skeletons/IA5String.h
View file @
5e03376b
...
...
@@ -12,7 +12,7 @@ typedef OCTET_STRING_t IA5String_t; /* Implemented via OCTET STRING */
/*
* IA5String ASN.1 type definition.
*/
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_IA5String
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_IA5String
;
asn_constr_check_f
IA5String_constraint
;
...
...
skeletons/INTEGER.c
View file @
5e03376b
...
...
@@ -11,10 +11,10 @@
/*
* INTEGER basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_INTEGER_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_INTEGER_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
2
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_INTEGER
=
{
asn
_TYPE_descriptor_t
asn
_DEF_INTEGER
=
{
"INTEGER"
,
ASN__PRIMITIVE_TYPE_free
,
INTEGER_print
,
...
...
@@ -24,10 +24,10 @@ asn1_TYPE_descriptor_t asn1_DEF_INTEGER = {
0
,
/* Not implemented yet */
INTEGER_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_INTEGER_tags
,
sizeof
(
asn
1_DEF_INTEGER_tags
)
/
sizeof
(
asn1
_DEF_INTEGER_tags
[
0
]),
asn
1
_DEF_INTEGER_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_INTEGER_tags
)
/
sizeof
(
asn1
_DEF_INTEGER_tags
[
0
]),
asn_DEF_INTEGER_tags
,
sizeof
(
asn
_DEF_INTEGER_tags
)
/
sizeof
(
asn
_DEF_INTEGER_tags
[
0
]),
asn_DEF_INTEGER_tags
,
/* Same as above */
sizeof
(
asn
_DEF_INTEGER_tags
)
/
sizeof
(
asn
_DEF_INTEGER_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -36,7 +36,7 @@ asn1_TYPE_descriptor_t asn1_DEF_INTEGER = {
* Encode INTEGER type using DER.
*/
asn_enc_rval_t
INTEGER_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
INTEGER_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
INTEGER_t
*
st
=
(
INTEGER_t
*
)
sptr
;
...
...
@@ -146,10 +146,10 @@ INTEGER__dump(const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key) {
}
*
p
++
=
h2c
[
*
buf
>>
4
];
*
p
++
=
h2c
[
*
buf
&
0x0F
];
*
p
++
=
':'
;
*
p
++
=
0x3a
;
/* ":" */
}
if
(
p
!=
scratch
)
p
--
;
/* Remove the last
':'
*/
p
--
;
/* Remove the last
":"
*/
wrote
+=
p
-
scratch
;
return
(
cb
(
scratch
,
p
-
scratch
,
app_key
)
<
0
)
?
-
1
:
wrote
;
...
...
@@ -159,7 +159,7 @@ INTEGER__dump(const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key) {
* INTEGER specific human-readable output.
*/
int
INTEGER_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
INTEGER_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
INTEGER_t
*
st
=
(
const
INTEGER_t
*
)
sptr
;
ssize_t
ret
;
...
...
@@ -176,7 +176,7 @@ INTEGER_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
asn_enc_rval_t
INTEGER_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
INTEGER_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
INTEGER_t
*
st
=
(
const
INTEGER_t
*
)
sptr
;
...
...
@@ -195,7 +195,7 @@ INTEGER_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
asn
1
_INTEGER2long
(
const
INTEGER_t
*
iptr
,
long
*
lptr
)
{
asn_INTEGER2long
(
const
INTEGER_t
*
iptr
,
long
*
lptr
)
{
uint8_t
*
b
,
*
end
;
size_t
size
;
long
l
;
...
...
skeletons/INTEGER.h
View file @
5e03376b
...
...
@@ -10,7 +10,7 @@
typedef
ASN__PRIMITIVE_TYPE_t
INTEGER_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_INTEGER
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_INTEGER
;
asn_struct_print_f
INTEGER_print
;
ber_type_decoder_f
INTEGER_decode_ber
;
...
...
@@ -26,6 +26,6 @@ xer_type_encoder_f INTEGER_encode_xer;
* -1/EINVAL: Mandatory argument missing
* -1/ERANGE: Value encoded is out of range for long representation
*/
int
asn
1
_INTEGER2long
(
const
INTEGER_t
*
i
,
long
*
l
);
int
asn_INTEGER2long
(
const
INTEGER_t
*
i
,
long
*
l
);
#endif
/* _INTEGER_H_ */
skeletons/ISO646String.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* ISO646String basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_ISO646String_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_ISO646String_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
26
<<
2
)),
/* [UNIVERSAL 26] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_ISO646String
=
{
asn
_TYPE_descriptor_t
asn
_DEF_ISO646String
=
{
"ISO646String"
,
OCTET_STRING_free
,
OCTET_STRING_print_ascii
,
/* ASCII subset */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_ISO646String = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer_ascii
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_ISO646String_tags
,
sizeof
(
asn
1
_DEF_ISO646String_tags
)
/
sizeof
(
asn
1
_DEF_ISO646String_tags
[
0
])
-
1
,
asn
1
_DEF_ISO646String_tags
,
sizeof
(
asn
1
_DEF_ISO646String_tags
)
/
sizeof
(
asn
1
_DEF_ISO646String_tags
[
0
]),
asn_DEF_ISO646String_tags
,
sizeof
(
asn_DEF_ISO646String_tags
)
/
sizeof
(
asn_DEF_ISO646String_tags
[
0
])
-
1
,
asn_DEF_ISO646String_tags
,
sizeof
(
asn_DEF_ISO646String_tags
)
/
sizeof
(
asn_DEF_ISO646String_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/ISO646String.h
View file @
5e03376b
...
...
@@ -10,6 +10,6 @@
typedef
VisibleString_t
ISO646String_t
;
/* Implemented using VisibleString */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_ISO646String
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_ISO646String
;
#endif
/* _ISO646String_H_ */
skeletons/NULL.c
View file @
5e03376b
...
...
@@ -9,10 +9,10 @@
/*
* NULL basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_NULL_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_NULL_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
5
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_NULL
=
{
asn
_TYPE_descriptor_t
asn
_DEF_NULL
=
{
"NULL"
,
BOOLEAN_free
,
NULL_print
,
...
...
@@ -22,16 +22,16 @@ asn1_TYPE_descriptor_t asn1_DEF_NULL = {
0
,
/* Not implemented yet */
NULL_encode_xer
,
/* Special handling of DER encoding */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_NULL_tags
,
sizeof
(
asn
1_DEF_NULL_tags
)
/
sizeof
(
asn1
_DEF_NULL_tags
[
0
]),
asn
1
_DEF_NULL_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_NULL_tags
)
/
sizeof
(
asn1
_DEF_NULL_tags
[
0
]),
asn_DEF_NULL_tags
,
sizeof
(
asn
_DEF_NULL_tags
)
/
sizeof
(
asn
_DEF_NULL_tags
[
0
]),
asn_DEF_NULL_tags
,
/* Same as above */
sizeof
(
asn
_DEF_NULL_tags
)
/
sizeof
(
asn
_DEF_NULL_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
asn_enc_rval_t
NULL_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
NULL_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
erval
;
...
...
@@ -46,7 +46,7 @@ NULL_encode_der(asn1_TYPE_descriptor_t *td, void *ptr,
}
asn_enc_rval_t
NULL_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
NULL_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
...
...
@@ -65,7 +65,7 @@ NULL_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
NULL_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
NULL_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
(
void
)
td
;
/* Unused argument */
...
...
skeletons/NULL.h
View file @
5e03376b
...
...
@@ -13,7 +13,7 @@
*/
typedef
int
NULL_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_NULL
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_NULL
;
asn_struct_print_f
NULL_print
;
der_type_encoder_f
NULL_encode_der
;
...
...
skeletons/NativeEnumerated.c
View file @
5e03376b
...
...
@@ -15,10 +15,10 @@
/*
* NativeEnumerated basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_NativeEnumerated_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_NativeEnumerated_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
10
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_NativeEnumerated
=
{
asn
_TYPE_descriptor_t
asn
_DEF_NativeEnumerated
=
{
"ENUMERATED"
,
/* The ASN.1 type is still ENUMERATED */
NativeInteger_free
,
NativeInteger_print
,
...
...
@@ -28,10 +28,10 @@ asn1_TYPE_descriptor_t asn1_DEF_NativeEnumerated = {
0
,
/* Not implemented yet */
NativeInteger_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_NativeEnumerated_tags
,
sizeof
(
asn
1_DEF_NativeEnumerated_tags
)
/
sizeof
(
asn1
_DEF_NativeEnumerated_tags
[
0
]),
asn
1
_DEF_NativeEnumerated_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_NativeEnumerated_tags
)
/
sizeof
(
asn1
_DEF_NativeEnumerated_tags
[
0
]),
asn_DEF_NativeEnumerated_tags
,
sizeof
(
asn
_DEF_NativeEnumerated_tags
)
/
sizeof
(
asn
_DEF_NativeEnumerated_tags
[
0
]),
asn_DEF_NativeEnumerated_tags
,
/* Same as above */
sizeof
(
asn
_DEF_NativeEnumerated_tags
)
/
sizeof
(
asn
_DEF_NativeEnumerated_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/NativeEnumerated.h
View file @
5e03376b
...
...
@@ -14,6 +14,6 @@
#include <NativeInteger.h>
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_NativeEnumerated
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_NativeEnumerated
;
#endif
/* _NativeEnumerated_H_ */
skeletons/NativeInteger.c
View file @
5e03376b
...
...
@@ -17,10 +17,10 @@
/*
* NativeInteger basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_NativeInteger_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_NativeInteger_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
2
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_NativeInteger
=
{
asn
_TYPE_descriptor_t
asn
_DEF_NativeInteger
=
{
"INTEGER"
,
/* The ASN.1 type is still INTEGER */
NativeInteger_free
,
NativeInteger_print
,
...
...
@@ -30,10 +30,10 @@ asn1_TYPE_descriptor_t asn1_DEF_NativeInteger = {
0
,
/* Not implemented yet */
NativeInteger_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_NativeInteger_tags
,
sizeof
(
asn
1_DEF_NativeInteger_tags
)
/
sizeof
(
asn1
_DEF_NativeInteger_tags
[
0
]),
asn
1
_DEF_NativeInteger_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_NativeInteger_tags
)
/
sizeof
(
asn1
_DEF_NativeInteger_tags
[
0
]),
asn_DEF_NativeInteger_tags
,
sizeof
(
asn
_DEF_NativeInteger_tags
)
/
sizeof
(
asn
_DEF_NativeInteger_tags
[
0
]),
asn_DEF_NativeInteger_tags
,
/* Same as above */
sizeof
(
asn
_DEF_NativeInteger_tags
)
/
sizeof
(
asn
_DEF_NativeInteger_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -42,7 +42,8 @@ asn1_TYPE_descriptor_t asn1_DEF_NativeInteger = {
* Decode INTEGER type.
*/
ber_dec_rval_t
NativeInteger_decode_ber
(
asn1_TYPE_descriptor_t
*
td
,
NativeInteger_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
int_ptr
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
int
*
Int
=
(
int
*
)
*
int_ptr
;
ber_dec_rval_t
rval
;
...
...
@@ -66,7 +67,8 @@ NativeInteger_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Check tags.
*/
rval
=
ber_check_tags
(
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
if
(
rval
.
code
!=
RC_OK
)
return
rval
;
...
...
@@ -94,7 +96,7 @@ NativeInteger_decode_ber(asn1_TYPE_descriptor_t *td,
tmp
.
buf
=
(
uint8_t
*
)
buf_ptr
;
tmp
.
size
=
length
;
if
(
asn
1
_INTEGER2long
(
&
tmp
,
&
l
))
{
if
(
asn_INTEGER2long
(
&
tmp
,
&
l
))
{
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
return
rval
;
...
...
@@ -128,7 +130,7 @@ NativeInteger_decode_ber(asn1_TYPE_descriptor_t *td,
* Encode the NativeInteger using the standard INTEGER type DER encoder.
*/
asn_enc_rval_t
NativeInteger_encode_der
(
asn
1
_TYPE_descriptor_t
*
sd
,
void
*
ptr
,
NativeInteger_encode_der
(
asn_TYPE_descriptor_t
*
sd
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
unsigned
int
Int
=
*
(
unsigned
int
*
)
ptr
;
/* Disable sign ext. */
...
...
@@ -162,7 +164,7 @@ NativeInteger_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
}
asn_enc_rval_t
NativeInteger_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
NativeInteger_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
char
scratch
[
32
];
/* Enough for 64-bit int */
...
...
@@ -186,7 +188,7 @@ NativeInteger_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
* INTEGER specific human-readable output.
*/
int
NativeInteger_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
NativeInteger_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
int
*
Int
=
(
const
int
*
)
sptr
;
char
scratch
[
32
];
/* Enough for 64-bit int */
...
...
@@ -205,7 +207,7 @@ NativeInteger_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
void
NativeInteger_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
NativeInteger_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
if
(
!
td
||
!
ptr
)
return
;
...
...
skeletons/NativeInteger.h
View file @
5e03376b
...
...
@@ -14,7 +14,7 @@
#include <asn_application.h>
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_NativeInteger
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_NativeInteger
;
asn_struct_free_f
NativeInteger_free
;
asn_struct_print_f
NativeInteger_print
;
...
...
skeletons/NativeReal.c
View file @
5e03376b
...
...
@@ -17,10 +17,10 @@
/*
* NativeReal basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_NativeReal_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_NativeReal_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
9
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_NativeReal
=
{
asn
_TYPE_descriptor_t
asn
_DEF_NativeReal
=
{
"REAL"
,
/* The ASN.1 type is still REAL */
NativeReal_free
,
NativeReal_print
,
...
...
@@ -30,10 +30,10 @@ asn1_TYPE_descriptor_t asn1_DEF_NativeReal = {
0
,
/* Not implemented yet */
NativeReal_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_NativeReal_tags
,
sizeof
(
asn
1_DEF_NativeReal_tags
)
/
sizeof
(
asn1
_DEF_NativeReal_tags
[
0
]),
asn
1
_DEF_NativeReal_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_NativeReal_tags
)
/
sizeof
(
asn1
_DEF_NativeReal_tags
[
0
]),
asn_DEF_NativeReal_tags
,
sizeof
(
asn
_DEF_NativeReal_tags
)
/
sizeof
(
asn
_DEF_NativeReal_tags
[
0
]),
asn_DEF_NativeReal_tags
,
/* Same as above */
sizeof
(
asn
_DEF_NativeReal_tags
)
/
sizeof
(
asn
_DEF_NativeReal_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -42,7 +42,8 @@ asn1_TYPE_descriptor_t asn1_DEF_NativeReal = {
* Decode REAL type.
*/
ber_dec_rval_t
NativeReal_decode_ber
(
asn1_TYPE_descriptor_t
*
td
,
NativeReal_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
dbl_ptr
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
double
*
Dbl
=
(
double
*
)
*
dbl_ptr
;
ber_dec_rval_t
rval
;
...
...
@@ -66,7 +67,8 @@ NativeReal_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Check tags.
*/
rval
=
ber_check_tags
(
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
if
(
rval
.
code
!=
RC_OK
)
return
rval
;
...
...
@@ -94,7 +96,7 @@ NativeReal_decode_ber(asn1_TYPE_descriptor_t *td,
tmp
.
buf
=
(
uint8_t
*
)
buf_ptr
;
tmp
.
size
=
length
;
if
(
asn
1
_REAL2double
(
&
tmp
,
&
d
))
{
if
(
asn_REAL2double
(
&
tmp
,
&
d
))
{
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
return
rval
;
...
...
@@ -116,14 +118,14 @@ NativeReal_decode_ber(asn1_TYPE_descriptor_t *td,
* Encode the NativeReal using the standard REAL type DER encoder.
*/
asn_enc_rval_t
NativeReal_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
NativeReal_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
double
Dbl
=
*
(
const
double
*
)
ptr
;
asn_enc_rval_t
erval
;
REAL_t
tmp
;
if
(
asn
1
_double2REAL
(
&
tmp
,
Dbl
))
{
if
(
asn_double2REAL
(
&
tmp
,
Dbl
))
{
erval
.
encoded
=
-
1
;
erval
.
failed_type
=
td
;
erval
.
structure_ptr
=
ptr
;
...
...
@@ -141,7 +143,7 @@ NativeReal_encode_der(asn1_TYPE_descriptor_t *td, void *ptr,
asn_enc_rval_t
NativeReal_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
NativeReal_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
double
*
Dbl
=
(
const
double
*
)
sptr
;
...
...
@@ -161,7 +163,7 @@ NativeReal_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
* REAL specific human-readable output.
*/
int
NativeReal_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
NativeReal_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
double
*
Dbl
=
(
const
double
*
)
sptr
;
...
...
@@ -174,7 +176,7 @@ NativeReal_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
void
NativeReal_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
NativeReal_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
if
(
!
td
||
!
ptr
)
return
;
...
...
skeletons/NativeReal.h
View file @
5e03376b
...
...
@@ -13,7 +13,7 @@
#include <asn_application.h>
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_NativeReal
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_NativeReal
;
asn_struct_free_f
NativeReal_free
;
asn_struct_print_f
NativeReal_print
;
...
...
skeletons/NumericString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* NumericString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_NumericString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_NumericString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
18
<<
2
)),
/* [UNIVERSAL 18] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_NumericString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_NumericString
=
{
"NumericString"
,
OCTET_STRING_free
,
OCTET_STRING_print_ascii
,
/* ASCII subset */
...
...
@@ -22,18 +22,18 @@ asn1_TYPE_descriptor_t asn1_DEF_NumericString = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer_ascii
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_NumericString_tags
,
sizeof
(
asn
1
_DEF_NumericString_tags
)
/
sizeof
(
asn
1
_DEF_NumericString_tags
[
0
])
-
1
,
asn
1
_DEF_NumericString_tags
,
sizeof
(
asn
1
_DEF_NumericString_tags
)
/
sizeof
(
asn
1
_DEF_NumericString_tags
[
0
]),
asn_DEF_NumericString_tags
,
sizeof
(
asn_DEF_NumericString_tags
)
/
sizeof
(
asn_DEF_NumericString_tags
[
0
])
-
1
,
asn_DEF_NumericString_tags
,
sizeof
(
asn_DEF_NumericString_tags
)
/
sizeof
(
asn_DEF_NumericString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
int
NumericString_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
NumericString_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
const
NumericString_t
*
st
=
(
const
NumericString_t
*
)
sptr
;
...
...
skeletons/NumericString.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
NumericString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_NumericString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_NumericString
;
asn_constr_check_f
NumericString_constraint
;
...
...
skeletons/OBJECT_IDENTIFIER.c
View file @
5e03376b
...
...
@@ -11,10 +11,10 @@
/*
* OBJECT IDENTIFIER basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_OBJECT_IDENTIFIER_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_OBJECT_IDENTIFIER_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
6
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_OBJECT_IDENTIFIER
=
{
asn
_TYPE_descriptor_t
asn
_DEF_OBJECT_IDENTIFIER
=
{
"OBJECT IDENTIFIER"
,
ASN__PRIMITIVE_TYPE_free
,
OBJECT_IDENTIFIER_print
,
...
...
@@ -24,19 +24,19 @@ asn1_TYPE_descriptor_t asn1_DEF_OBJECT_IDENTIFIER = {
0
,
/* Not implemented yet */
OBJECT_IDENTIFIER_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_OBJECT_IDENTIFIER_tags
,
sizeof
(
asn
1
_DEF_OBJECT_IDENTIFIER_tags
)
/
sizeof
(
asn
1
_DEF_OBJECT_IDENTIFIER_tags
[
0
]),
asn
1
_DEF_OBJECT_IDENTIFIER_tags
,
/* Same as above */
sizeof
(
asn
1
_DEF_OBJECT_IDENTIFIER_tags
)
/
sizeof
(
asn
1
_DEF_OBJECT_IDENTIFIER_tags
[
0
]),
asn_DEF_OBJECT_IDENTIFIER_tags
,
sizeof
(
asn_DEF_OBJECT_IDENTIFIER_tags
)
/
sizeof
(
asn_DEF_OBJECT_IDENTIFIER_tags
[
0
]),
asn_DEF_OBJECT_IDENTIFIER_tags
,
/* Same as above */
sizeof
(
asn_DEF_OBJECT_IDENTIFIER_tags
)
/
sizeof
(
asn_DEF_OBJECT_IDENTIFIER_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
int
OBJECT_IDENTIFIER_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
OBJECT_IDENTIFIER_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
const
OBJECT_IDENTIFIER_t
*
st
=
(
const
OBJECT_IDENTIFIER_t
*
)
sptr
;
...
...
@@ -263,7 +263,7 @@ OBJECT_IDENTIFIER__dump_body(const OBJECT_IDENTIFIER_t *st, asn_app_consume_byte
}
asn_enc_rval_t
OBJECT_IDENTIFIER_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
OBJECT_IDENTIFIER_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
OBJECT_IDENTIFIER_t
*
st
=
(
const
OBJECT_IDENTIFIER_t
*
)
sptr
;
...
...
@@ -282,7 +282,7 @@ OBJECT_IDENTIFIER_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
OBJECT_IDENTIFIER_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
OBJECT_IDENTIFIER_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
OBJECT_IDENTIFIER_t
*
st
=
(
const
OBJECT_IDENTIFIER_t
*
)
sptr
;
...
...
skeletons/OBJECT_IDENTIFIER.h
View file @
5e03376b
...
...
@@ -10,7 +10,7 @@
typedef
ASN__PRIMITIVE_TYPE_t
OBJECT_IDENTIFIER_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_OBJECT_IDENTIFIER
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_OBJECT_IDENTIFIER
;
asn_struct_print_f
OBJECT_IDENTIFIER_print
;
asn_constr_check_f
OBJECT_IDENTIFIER_constraint
;
...
...
skeletons/OCTET_STRING.h
View file @
5e03376b
...
...
@@ -11,10 +11,10 @@ typedef struct OCTET_STRING {
uint8_t
*
buf
;
/* Buffer with consecutive OCTET_STRING bits */
int
size
;
/* Size of the buffer */
ber_dec_ctx_t
_ber_dec
_ctx
;
/* Parsing across buffer boundaries */
asn_struct_ctx_t
_asn
_ctx
;
/* Parsing across buffer boundaries */
}
OCTET_STRING_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_OCTET_STRING
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_OCTET_STRING
;
asn_struct_free_f
OCTET_STRING_free
;
asn_struct_print_f
OCTET_STRING_print
;
...
...
skeletons/ObjectDescriptor.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* ObjectDescriptor basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_ObjectDescriptor_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_ObjectDescriptor_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
7
<<
2
)),
/* [UNIVERSAL 7] IMPLICIT ... */
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_ObjectDescriptor
=
{
asn
_TYPE_descriptor_t
asn
_DEF_ObjectDescriptor
=
{
"ObjectDescriptor"
,
OCTET_STRING_free
,
OCTET_STRING_print_ascii
,
/* Treat as ASCII subset (it's not) */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_ObjectDescriptor = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer_ascii
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_ObjectDescriptor_tags
,
sizeof
(
asn
1
_DEF_ObjectDescriptor_tags
)
/
sizeof
(
asn
1
_DEF_ObjectDescriptor_tags
[
0
])
-
1
,
asn
1
_DEF_ObjectDescriptor_tags
,
sizeof
(
asn
1
_DEF_ObjectDescriptor_tags
)
/
sizeof
(
asn
1
_DEF_ObjectDescriptor_tags
[
0
]),
asn_DEF_ObjectDescriptor_tags
,
sizeof
(
asn_DEF_ObjectDescriptor_tags
)
/
sizeof
(
asn_DEF_ObjectDescriptor_tags
[
0
])
-
1
,
asn_DEF_ObjectDescriptor_tags
,
sizeof
(
asn_DEF_ObjectDescriptor_tags
)
/
sizeof
(
asn_DEF_ObjectDescriptor_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/ObjectDescriptor.h
View file @
5e03376b
...
...
@@ -9,6 +9,6 @@
typedef
GraphicString_t
ObjectDescriptor_t
;
/* Implemented via GraphicString */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_ObjectDescriptor
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_ObjectDescriptor
;
#endif
/* _ObjectDescriptor_H_ */
skeletons/PrintableString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* PrintableString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_PrintableString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_PrintableString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
19
<<
2
)),
/* [UNIVERSAL 19] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_PrintableString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_PrintableString
=
{
"PrintableString"
,
OCTET_STRING_free
,
OCTET_STRING_print_ascii
,
/* ASCII subset */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_PrintableString = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer_ascii
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_PrintableString_tags
,
sizeof
(
asn
1
_DEF_PrintableString_tags
)
/
sizeof
(
asn
1
_DEF_PrintableString_tags
[
0
])
-
1
,
asn
1
_DEF_PrintableString_tags
,
sizeof
(
asn
1
_DEF_PrintableString_tags
)
/
sizeof
(
asn
1
_DEF_PrintableString_tags
[
0
]),
asn_DEF_PrintableString_tags
,
sizeof
(
asn_DEF_PrintableString_tags
)
/
sizeof
(
asn_DEF_PrintableString_tags
[
0
])
-
1
,
asn_DEF_PrintableString_tags
,
sizeof
(
asn_DEF_PrintableString_tags
)
/
sizeof
(
asn_DEF_PrintableString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -56,7 +56,7 @@ static int _PrintableString_alphabet[256] = {
};
int
PrintableString_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
PrintableString_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
const
PrintableString_t
*
st
=
(
const
PrintableString_t
*
)
sptr
;
...
...
skeletons/PrintableString.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
PrintableString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_PrintableString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_PrintableString
;
asn_constr_check_f
PrintableString_constraint
;
...
...
skeletons/REAL.c
View file @
5e03376b
...
...
@@ -20,10 +20,10 @@ static const double real_zero;
/*
* REAL basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_REAL_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_REAL_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
9
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_REAL
=
{
asn
_TYPE_descriptor_t
asn
_DEF_REAL
=
{
"REAL"
,
ASN__PRIMITIVE_TYPE_free
,
REAL_print
,
...
...
@@ -33,10 +33,10 @@ asn1_TYPE_descriptor_t asn1_DEF_REAL = {
0
,
/* Not implemented yet */
REAL_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_REAL_tags
,
sizeof
(
asn
1_DEF_REAL_tags
)
/
sizeof
(
asn1
_DEF_REAL_tags
[
0
]),
asn
1
_DEF_REAL_tags
,
/* Same as above */
sizeof
(
asn
1_DEF_REAL_tags
)
/
sizeof
(
asn1
_DEF_REAL_tags
[
0
]),
asn_DEF_REAL_tags
,
sizeof
(
asn
_DEF_REAL_tags
)
/
sizeof
(
asn
_DEF_REAL_tags
[
0
]),
asn_DEF_REAL_tags
,
/* Same as above */
sizeof
(
asn
_DEF_REAL_tags
)
/
sizeof
(
asn
_DEF_REAL_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -182,7 +182,7 @@ REAL__dump(double d, int canonical, asn_app_consume_bytes_f *cb, void *app_key)
}
int
REAL_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
REAL_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
REAL_t
*
st
=
(
const
REAL_t
*
)
sptr
;
ssize_t
ret
;
...
...
@@ -193,7 +193,7 @@ REAL_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
if
(
!
st
||
!
st
->
buf
)
ret
=
cb
(
"<absent>"
,
8
,
app_key
);
else
if
(
asn
1
_REAL2double
(
st
,
&
d
))
else
if
(
asn_REAL2double
(
st
,
&
d
))
ret
=
cb
(
"<error>"
,
7
,
app_key
);
else
ret
=
REAL__dump
(
d
,
0
,
cb
,
app_key
);
...
...
@@ -202,7 +202,7 @@ REAL_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
asn_enc_rval_t
REAL_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
REAL_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
REAL_t
*
st
=
(
REAL_t
*
)
sptr
;
...
...
@@ -211,7 +211,7 @@ REAL_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
(
void
)
ilevel
;
if
(
!
st
||
!
st
->
buf
||
asn
1
_REAL2double
(
st
,
&
d
))
if
(
!
st
||
!
st
->
buf
||
asn_REAL2double
(
st
,
&
d
))
_ASN_ENCODE_FAILED
;
er
.
encoded
=
REAL__dump
(
d
,
flags
&
XER_F_CANONICAL
,
cb
,
app_key
);
...
...
@@ -221,7 +221,7 @@ REAL_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
asn
1
_REAL2double
(
const
REAL_t
*
st
,
double
*
dbl_value
)
{
asn_REAL2double
(
const
REAL_t
*
st
,
double
*
dbl_value
)
{
unsigned
int
octv
;
if
(
!
st
||
!
st
->
buf
)
{
...
...
@@ -372,7 +372,7 @@ asn1_REAL2double(const REAL_t *st, double *dbl_value) {
* [1 bit sign] [11 bits exponent] [52 bits mantissa]
*/
int
asn
1
_double2REAL
(
REAL_t
*
st
,
double
dbl_value
)
{
asn_double2REAL
(
REAL_t
*
st
,
double
dbl_value
)
{
#ifdef WORDS_BIGENDIAN
/* Known to be big-endian */
int
littleEndian
=
0
;
#else
/* need to test: have no explicit information */
...
...
skeletons/REAL.h
View file @
5e03376b
...
...
@@ -10,7 +10,7 @@
typedef
ASN__PRIMITIVE_TYPE_t
REAL_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_REAL
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_REAL
;
asn_struct_print_f
REAL_print
;
xer_type_encoder_f
REAL_encode_xer
;
...
...
@@ -27,7 +27,7 @@ ssize_t REAL__dump(double d, int canonical, asn_app_consume_bytes_f *cb, void *a
* 0: Value converted successfully
* -1: An error occured while converting the value: invalid format.
*/
int
asn
1
_REAL2double
(
const
REAL_t
*
real_ptr
,
double
*
d
);
int
asn
1
_double2REAL
(
REAL_t
*
real_ptr
,
double
d
);
int
asn_REAL2double
(
const
REAL_t
*
real_ptr
,
double
*
d
);
int
asn_double2REAL
(
REAL_t
*
real_ptr
,
double
d
);
#endif
/* ASN_TYPE_REAL_H */
skeletons/RELATIVE-OID.c
View file @
5e03376b
...
...
@@ -12,10 +12,10 @@
/*
* RELATIVE-OID basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_RELATIVE_OID_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_RELATIVE_OID_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
13
<<
2
))
};
asn
1_TYPE_descriptor_t
asn1
_DEF_RELATIVE_OID
=
{
asn
_TYPE_descriptor_t
asn
_DEF_RELATIVE_OID
=
{
"RELATIVE-OID"
,
ASN__PRIMITIVE_TYPE_free
,
RELATIVE_OID_print
,
...
...
@@ -25,12 +25,12 @@ asn1_TYPE_descriptor_t asn1_DEF_RELATIVE_OID = {
0
,
/* Not implemented yet */
RELATIVE_OID_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_RELATIVE_OID_tags
,
sizeof
(
asn
1
_DEF_RELATIVE_OID_tags
)
/
sizeof
(
asn
1
_DEF_RELATIVE_OID_tags
[
0
]),
asn
1
_DEF_RELATIVE_OID_tags
,
/* Same as above */
sizeof
(
asn
1
_DEF_RELATIVE_OID_tags
)
/
sizeof
(
asn
1
_DEF_RELATIVE_OID_tags
[
0
]),
asn_DEF_RELATIVE_OID_tags
,
sizeof
(
asn_DEF_RELATIVE_OID_tags
)
/
sizeof
(
asn_DEF_RELATIVE_OID_tags
[
0
]),
asn_DEF_RELATIVE_OID_tags
,
/* Same as above */
sizeof
(
asn_DEF_RELATIVE_OID_tags
)
/
sizeof
(
asn_DEF_RELATIVE_OID_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -65,7 +65,7 @@ RELATIVE_OID__dump_body(const RELATIVE_OID_t *st, asn_app_consume_bytes_f *cb, v
}
int
RELATIVE_OID_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
RELATIVE_OID_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
RELATIVE_OID_t
*
st
=
(
const
RELATIVE_OID_t
*
)
sptr
;
...
...
@@ -86,7 +86,7 @@ RELATIVE_OID_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
asn_enc_rval_t
RELATIVE_OID_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
RELATIVE_OID_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
RELATIVE_OID_t
*
st
=
(
RELATIVE_OID_t
*
)
sptr
;
...
...
skeletons/RELATIVE-OID.h
View file @
5e03376b
...
...
@@ -10,7 +10,7 @@
/* Implemented via OBJECT IDENTIFIER */
typedef
OBJECT_IDENTIFIER_t
RELATIVE_OID_t
;
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_RELATIVE_OID
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_RELATIVE_OID
;
asn_struct_print_f
RELATIVE_OID_print
;
xer_type_encoder_f
RELATIVE_OID_encode_xer
;
...
...
skeletons/T61String.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* T61String basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_T61String_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_T61String_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
20
<<
2
)),
/* [UNIVERSAL 20] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_T61String
=
{
asn
_TYPE_descriptor_t
asn
_DEF_T61String
=
{
"T61String"
,
OCTET_STRING_free
,
OCTET_STRING_print
,
/* non-ascii string */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_T61String = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_T61String_tags
,
sizeof
(
asn
1
_DEF_T61String_tags
)
/
sizeof
(
asn
1
_DEF_T61String_tags
[
0
])
-
1
,
asn
1
_DEF_T61String_tags
,
sizeof
(
asn
1
_DEF_T61String_tags
)
/
sizeof
(
asn
1
_DEF_T61String_tags
[
0
]),
asn_DEF_T61String_tags
,
sizeof
(
asn_DEF_T61String_tags
)
/
sizeof
(
asn_DEF_T61String_tags
[
0
])
-
1
,
asn_DEF_T61String_tags
,
sizeof
(
asn_DEF_T61String_tags
)
/
sizeof
(
asn_DEF_T61String_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/T61String.h
View file @
5e03376b
...
...
@@ -9,6 +9,6 @@
typedef
OCTET_STRING_t
T61String_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_T61String
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_T61String
;
#endif
/* _T61String_H_ */
skeletons/TeletexString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* TeletexString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_TeletexString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_TeletexString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
20
<<
2
)),
/* [UNIVERSAL 20] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
)),
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_TeletexString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_TeletexString
=
{
"TeletexString"
,
OCTET_STRING_free
,
OCTET_STRING_print
,
/* non-ascii string */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_TeletexString = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_TeletexString_tags
,
sizeof
(
asn
1
_DEF_TeletexString_tags
)
/
sizeof
(
asn
1
_DEF_TeletexString_tags
[
0
])
-
1
,
asn
1
_DEF_TeletexString_tags
,
sizeof
(
asn
1
_DEF_TeletexString_tags
)
/
sizeof
(
asn
1
_DEF_TeletexString_tags
[
0
]),
asn_DEF_TeletexString_tags
,
sizeof
(
asn_DEF_TeletexString_tags
)
/
sizeof
(
asn_DEF_TeletexString_tags
[
0
])
-
1
,
asn_DEF_TeletexString_tags
,
sizeof
(
asn_DEF_TeletexString_tags
)
/
sizeof
(
asn_DEF_TeletexString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/TeletexString.h
View file @
5e03376b
...
...
@@ -9,6 +9,6 @@
typedef
OCTET_STRING_t
TeletexString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_TeletexString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_TeletexString
;
#endif
/* _TeletexString_H_ */
skeletons/UTCTime.c
View file @
5e03376b
...
...
@@ -14,12 +14,12 @@
/*
* UTCTime basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_UTCTime_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_UTCTime_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
23
<<
2
)),
/* [UNIVERSAL 23] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
26
<<
2
)),
/* [UNIVERSAL 26] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_UTCTime
=
{
asn
_TYPE_descriptor_t
asn
_DEF_UTCTime
=
{
"UTCTime"
,
OCTET_STRING_free
,
UTCTime_print
,
...
...
@@ -29,12 +29,12 @@ asn1_TYPE_descriptor_t asn1_DEF_UTCTime = {
0
,
/* Not implemented yet */
UTCTime_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_UTCTime_tags
,
sizeof
(
asn
1
_DEF_UTCTime_tags
)
/
sizeof
(
asn
1
_DEF_UTCTime_tags
[
0
])
-
2
,
asn
1
_DEF_UTCTime_tags
,
sizeof
(
asn
1
_DEF_UTCTime_tags
)
/
sizeof
(
asn
1
_DEF_UTCTime_tags
[
0
]),
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
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -45,7 +45,7 @@ asn1_TYPE_descriptor_t asn1_DEF_UTCTime = {
* Check that the time looks like the time.
*/
int
UTCTime_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
UTCTime_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
const
UTCTime_t
*
st
=
(
const
UTCTime_t
*
)
sptr
;
time_t
tloc
;
...
...
@@ -63,7 +63,7 @@ UTCTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
}
asn_enc_rval_t
UTCTime_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
UTCTime_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
OCTET_STRING_t
st
;
...
...
@@ -93,7 +93,7 @@ UTCTime_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
UTCTime_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
UTCTime_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
UTCTime_t
*
st
=
(
const
UTCTime_t
*
)
sptr
;
...
...
skeletons/UTCTime.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
UTCTime_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_UTCTime
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_UTCTime
;
asn_struct_print_f
UTCTime_print
;
asn_constr_check_f
UTCTime_constraint
;
...
...
skeletons/UTF8String.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* UTF8String basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_UTF8String_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_UTF8String_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
12
<<
2
)),
/* [UNIVERSAL 12] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
)),
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_UTF8String
=
{
asn
_TYPE_descriptor_t
asn
_DEF_UTF8String
=
{
"UTF8String"
,
OCTET_STRING_free
,
UTF8String_print
,
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_UTF8String = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer_ascii
,
/* Already in UTF-8 format */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_UTF8String_tags
,
sizeof
(
asn
1
_DEF_UTF8String_tags
)
/
sizeof
(
asn
1
_DEF_UTF8String_tags
[
0
])
-
1
,
asn
1
_DEF_UTF8String_tags
,
sizeof
(
asn
1
_DEF_UTF8String_tags
)
/
sizeof
(
asn
1
_DEF_UTF8String_tags
[
0
]),
asn_DEF_UTF8String_tags
,
sizeof
(
asn_DEF_UTF8String_tags
)
/
sizeof
(
asn_DEF_UTF8String_tags
[
0
])
-
1
,
asn_DEF_UTF8String_tags
,
sizeof
(
asn_DEF_UTF8String_tags
)
/
sizeof
(
asn_DEF_UTF8String_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -42,7 +42,7 @@ static int _UTF8String_h2[16] = {
};
int
UTF8String_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
UTF8String_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
ssize_t
len
;
len
=
UTF8String_length
((
const
UTF8String_t
*
)
sptr
,
td
->
name
,
...
...
@@ -113,7 +113,7 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name,
}
int
UTF8String_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
UTF8String_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
UTF8String_t
*
st
=
(
const
UTF8String_t
*
)
sptr
;
...
...
skeletons/UTF8String.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
UTF8String_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_UTF8String
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_UTF8String
;
asn_struct_print_f
UTF8String_print
;
asn_constr_check_f
UTF8String_constraint
;
...
...
skeletons/UniversalString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* UniversalString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_UniversalString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_UniversalString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
28
<<
2
)),
/* [UNIVERSAL 28] IMPLICIT ...*/
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_UniversalString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_UniversalString
=
{
"UniversalString"
,
OCTET_STRING_free
,
UniversalString_print
,
/* Convert into UTF8 and print */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_UniversalString = {
0
,
/* Not implemented yet */
UniversalString_encode_xer
,
/* Conver into UTF8 */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_UniversalString_tags
,
sizeof
(
asn
1
_DEF_UniversalString_tags
)
/
sizeof
(
asn
1
_DEF_UniversalString_tags
[
0
])
-
1
,
asn
1
_DEF_UniversalString_tags
,
sizeof
(
asn
1
_DEF_UniversalString_tags
)
/
sizeof
(
asn
1
_DEF_UniversalString_tags
[
0
]),
asn_DEF_UniversalString_tags
,
sizeof
(
asn_DEF_UniversalString_tags
)
/
sizeof
(
asn_DEF_UniversalString_tags
[
0
])
-
1
,
asn_DEF_UniversalString_tags
,
sizeof
(
asn_DEF_UniversalString_tags
)
/
sizeof
(
asn_DEF_UniversalString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
@@ -93,7 +93,7 @@ UniversalString__dump(const UniversalString_t *st,
}
asn_enc_rval_t
UniversalString_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
UniversalString_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
UniversalString_t
*
st
=
(
const
UniversalString_t
*
)
sptr
;
...
...
@@ -112,7 +112,7 @@ UniversalString_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
UniversalString_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
UniversalString_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
UniversalString_t
*
st
=
(
const
UniversalString_t
*
)
sptr
;
...
...
skeletons/UniversalString.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
UniversalString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_UniversalString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_UniversalString
;
asn_struct_print_f
UniversalString_print
;
/* Human-readable output */
xer_type_encoder_f
UniversalString_encode_xer
;
...
...
skeletons/VideotexString.c
View file @
5e03376b
...
...
@@ -8,11 +8,11 @@
/*
* VideotexString basic type description.
*/
static
ber_tlv_tag_t
asn
1
_DEF_VideotexString_tags
[]
=
{
static
ber_tlv_tag_t
asn_DEF_VideotexString_tags
[]
=
{
(
ASN_TAG_CLASS_UNIVERSAL
|
(
21
<<
2
)),
/* [UNIVERSAL 21] IMPLICIT */
(
ASN_TAG_CLASS_UNIVERSAL
|
(
4
<<
2
))
/* ... OCTET STRING */
};
asn
1_TYPE_descriptor_t
asn1
_DEF_VideotexString
=
{
asn
_TYPE_descriptor_t
asn
_DEF_VideotexString
=
{
"VideotexString"
,
OCTET_STRING_free
,
OCTET_STRING_print
,
/* non-ascii string */
...
...
@@ -22,12 +22,12 @@ asn1_TYPE_descriptor_t asn1_DEF_VideotexString = {
0
,
/* Not implemented yet */
OCTET_STRING_encode_xer
,
/* Implemented in terms of OCTET STRING */
0
,
/* Use generic outmost tag fetcher */
asn
1
_DEF_VideotexString_tags
,
sizeof
(
asn
1
_DEF_VideotexString_tags
)
/
sizeof
(
asn
1
_DEF_VideotexString_tags
[
0
])
-
1
,
asn
1
_DEF_VideotexString_tags
,
sizeof
(
asn
1
_DEF_VideotexString_tags
)
/
sizeof
(
asn
1
_DEF_VideotexString_tags
[
0
]),
asn_DEF_VideotexString_tags
,
sizeof
(
asn_DEF_VideotexString_tags
)
/
sizeof
(
asn_DEF_VideotexString_tags
[
0
])
-
1
,
asn_DEF_VideotexString_tags
,
sizeof
(
asn_DEF_VideotexString_tags
)
/
sizeof
(
asn_DEF_VideotexString_tags
[
0
]),
0
,
0
,
/* No members */
0
/* No specifics */
};
...
...
skeletons/VideotexString.h
View file @
5e03376b
...
...
@@ -9,6 +9,6 @@
typedef
OCTET_STRING_t
VideotexString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_VideotexString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_VideotexString
;
#endif
/* _VideotexString_H_ */
skeletons/VisibleString.h
View file @
5e03376b
...
...
@@ -9,7 +9,7 @@
typedef
OCTET_STRING_t
VisibleString_t
;
/* Implemented via OCTET STRING */
extern
asn
1_TYPE_descriptor_t
asn1
_DEF_VisibleString
;
extern
asn
_TYPE_descriptor_t
asn
_DEF_VisibleString
;
asn_constr_check_f
VisibleString_constraint
;
...
...
skeletons/asn_application.h
View file @
5e03376b
...
...
@@ -20,6 +20,6 @@
typedef
int
(
asn_app_consume_bytes_f
)(
const
void
*
buffer
,
size_t
size
,
void
*
application_specific_key
);
#include <constr_TYPE.h>
/* for asn
1
_TYPE_descriptor_t */
#include <constr_TYPE.h>
/* for asn_TYPE_descriptor_t */
#endif
/* _ASN_APPLICATION_H_ */
skeletons/ber_codec_prim.c
View file @
5e03376b
...
...
@@ -11,7 +11,8 @@
* Decode an always-primitive type.
*/
ber_dec_rval_t
ber_decode_primitive
(
asn1_TYPE_descriptor_t
*
td
,
ber_decode_primitive
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
ASN__PRIMITIVE_TYPE_t
*
st
=
(
ASN__PRIMITIVE_TYPE_t
*
)
*
sptr
;
ber_dec_rval_t
rval
;
...
...
@@ -35,7 +36,8 @@ ber_decode_primitive(asn1_TYPE_descriptor_t *td,
/*
* Check tags and extract value length.
*/
rval
=
ber_check_tags
(
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
0
,
buf_ptr
,
size
,
tag_mode
,
0
,
&
length
,
0
);
if
(
rval
.
code
!=
RC_OK
)
return
rval
;
...
...
@@ -78,7 +80,7 @@ ber_decode_primitive(asn1_TYPE_descriptor_t *td,
* Encode an always-primitive type using DER.
*/
asn_enc_rval_t
der_encode_primitive
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
der_encode_primitive
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
erval
;
...
...
@@ -113,7 +115,7 @@ der_encode_primitive(asn1_TYPE_descriptor_t *td, void *sptr,
}
void
ASN__PRIMITIVE_TYPE_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
ASN__PRIMITIVE_TYPE_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
contents_only
)
{
ASN__PRIMITIVE_TYPE_t
*
st
=
(
ASN__PRIMITIVE_TYPE_t
*
)
sptr
;
...
...
skeletons/constr_CHOICE.c
View file @
5e03376b
...
...
@@ -70,8 +70,8 @@ static void _set_present_idx(void *sptr, int offset, int size, int pres);
*/
static
int
_search4tag
(
const
void
*
ap
,
const
void
*
bp
)
{
const
asn
1_TYPE_tag2member_t
*
a
=
(
const
asn1
_TYPE_tag2member_t
*
)
ap
;
const
asn
1_TYPE_tag2member_t
*
b
=
(
const
asn1
_TYPE_tag2member_t
*
)
bp
;
const
asn
_TYPE_tag2member_t
*
a
=
(
const
asn
_TYPE_tag2member_t
*
)
ap
;
const
asn
_TYPE_tag2member_t
*
b
=
(
const
asn
_TYPE_tag2member_t
*
)
bp
;
int
a_class
=
BER_TAG_CLASS
(
a
->
el_tag
);
int
b_class
=
BER_TAG_CLASS
(
b
->
el_tag
);
...
...
@@ -97,23 +97,22 @@ _search4tag(const void *ap, const void *bp) {
* The decoder of the CHOICE type.
*/
ber_dec_rval_t
CHOICE_decode_ber
(
asn
1
_TYPE_descriptor_t
*
td
,
CHOICE_decode_ber
(
asn
_codec_ctx_t
*
opt_codec_ctx
,
asn
_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
* Bring closer parts of structure description.
*/
asn
1_CHOICE_specifics_t
*
specs
=
(
asn1
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn
1
_TYPE_member_t
*
elements
=
td
->
elements
;
asn
_CHOICE_specifics_t
*
specs
=
(
asn
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
elements
=
td
->
elements
;
/*
* Parts of the structure being constructed.
*/
void
*
st
=
*
struct_ptr
;
/* Target structure. */
ber_dec
_ctx_t
*
ctx
;
/* Decoder context */
asn_struct
_ctx_t
*
ctx
;
/* Decoder context */
ber_tlv_tag_t
tlv_tag
;
/* T from TLV */
ssize_t
tag_len
;
/* Length of TLV's T */
//ber_tlv_len_t tlv_len; /* L from TLV */
ber_dec_rval_t
rval
;
/* Return code from subparsers */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
...
...
@@ -133,7 +132,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Restore parsing context.
*/
ctx
=
(
ber_dec
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
ctx
=
(
asn_struct
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
/*
* Start to parse where left previously
...
...
@@ -147,7 +146,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *td,
*/
if
(
tag_mode
||
td
->
tags_count
)
{
rval
=
ber_check_tags
(
td
,
ctx
,
ptr
,
size
,
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
ctx
,
ptr
,
size
,
tag_mode
,
-
1
,
&
ctx
->
left
,
0
);
if
(
rval
.
code
!=
RC_OK
)
{
ASN_DEBUG
(
"%s tagging check failed: %d"
,
...
...
@@ -184,8 +183,8 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *td,
}
do
{
asn
1
_TYPE_tag2member_t
*
t2m
;
asn
1
_TYPE_tag2member_t
key
;
asn_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
key
;
key
.
el_tag
=
tlv_tag
;
(
void
*
)
t2m
=
bsearch
(
&
key
,
...
...
@@ -231,7 +230,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *td,
* Read in the element.
*/
do
{
asn
1
_TYPE_member_t
*
elm
;
/* CHOICE's element */
asn_TYPE_member_t
*
elm
;
/* CHOICE's element */
void
*
memb_ptr
;
/* Pointer to the member */
void
**
memb_ptr2
;
/* Pointer to that pointer */
...
...
@@ -256,7 +255,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Invoke the member fetch routine according to member's type
*/
rval
=
elm
->
type
->
ber_decoder
(
elm
->
type
,
rval
=
elm
->
type
->
ber_decoder
(
opt_codec_ctx
,
elm
->
type
,
memb_ptr2
,
ptr
,
LEFT
,
elm
->
tag_mode
);
switch
(
rval
.
code
)
{
...
...
@@ -353,12 +352,12 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *td,
}
asn_enc_rval_t
CHOICE_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
CHOICE_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
struct_ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn
1_CHOICE_specifics_t
*
specs
=
(
asn1
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn
1
_TYPE_member_t
*
elm
;
/* CHOICE element */
asn
_CHOICE_specifics_t
*
specs
=
(
asn
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
elm
;
/* CHOICE element */
asn_enc_rval_t
erval
;
void
*
memb_ptr
;
size_t
computed_size
=
0
;
...
...
@@ -453,8 +452,8 @@ CHOICE_encode_der(asn1_TYPE_descriptor_t *td,
}
ber_tlv_tag_t
CHOICE_outmost_tag
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
)
{
asn
1_CHOICE_specifics_t
*
specs
=
(
asn1
_CHOICE_specifics_t
*
)
td
->
specifics
;
CHOICE_outmost_tag
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
)
{
asn
_CHOICE_specifics_t
*
specs
=
(
asn
_CHOICE_specifics_t
*
)
td
->
specifics
;
int
present
;
assert
(
tag_mode
==
0
);
...
...
@@ -466,7 +465,7 @@ CHOICE_outmost_tag(asn1_TYPE_descriptor_t *td, const void *ptr, int tag_mode, be
present
=
_fetch_present_idx
(
ptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
if
(
present
>
0
||
present
<=
td
->
elements_count
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
@@ -477,7 +476,7 @@ CHOICE_outmost_tag(asn1_TYPE_descriptor_t *td, const void *ptr, int tag_mode, be
((
const
char
*
)
ptr
+
elm
->
memb_offset
);
}
return
asn
1
_TYPE_outmost_tag
(
elm
->
type
,
memb_ptr
,
return
asn_TYPE_outmost_tag
(
elm
->
type
,
memb_ptr
,
elm
->
tag_mode
,
elm
->
tag
);
}
else
{
return
(
ber_tlv_tag_t
)
-
1
;
...
...
@@ -485,9 +484,9 @@ CHOICE_outmost_tag(asn1_TYPE_descriptor_t *td, const void *ptr, int tag_mode, be
}
int
CHOICE_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
CHOICE_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
asn
1_CHOICE_specifics_t
*
specs
=
(
asn1
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn
_CHOICE_specifics_t
*
specs
=
(
asn
_CHOICE_specifics_t
*
)
td
->
specifics
;
int
present
;
if
(
!
sptr
)
{
...
...
@@ -502,7 +501,7 @@ CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
*/
present
=
_fetch_present_idx
(
sptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
@@ -541,10 +540,10 @@ CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
}
asn_enc_rval_t
CHOICE_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
CHOICE_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn
1_CHOICE_specifics_t
*
specs
=
(
asn1
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn
_CHOICE_specifics_t
*
specs
=
(
asn
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_enc_rval_t
er
;
int
present
;
...
...
@@ -560,7 +559,7 @@ CHOICE_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
_ASN_ENCODE_FAILED
;
}
else
{
asn_enc_rval_t
tmper
;
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
void
*
memb_ptr
;
const
char
*
mname
=
elm
->
name
;
unsigned
int
mlen
=
strlen
(
mname
);
...
...
@@ -592,9 +591,9 @@ CHOICE_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
CHOICE_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
CHOICE_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn
1_CHOICE_specifics_t
*
specs
=
(
asn1
_CHOICE_specifics_t
*
)
td
->
specifics
;
asn
_CHOICE_specifics_t
*
specs
=
(
asn
_CHOICE_specifics_t
*
)
td
->
specifics
;
int
present
;
if
(
!
sptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
...
...
@@ -608,7 +607,7 @@ CHOICE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
* Print that element.
*/
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
@@ -633,8 +632,8 @@ CHOICE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
void
CHOICE_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
asn
1_CHOICE_specifics_t
*
specs
=
(
asn1
_CHOICE_specifics_t
*
)
td
->
specifics
;
CHOICE_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
asn
_CHOICE_specifics_t
*
specs
=
(
asn
_CHOICE_specifics_t
*
)
td
->
specifics
;
int
present
;
if
(
!
td
||
!
ptr
)
...
...
@@ -651,7 +650,7 @@ CHOICE_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
* Free that element.
*/
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
skeletons/constr_CHOICE.h
View file @
5e03376b
...
...
@@ -7,7 +7,7 @@
#include <asn_application.h>
typedef
struct
asn
1
_CHOICE_specifics_s
{
typedef
struct
asn_CHOICE_specifics_s
{
/*
* Target structure description.
*/
...
...
@@ -19,14 +19,14 @@ typedef struct asn1_CHOICE_specifics_s {
/*
* Tags to members mapping table.
*/
asn
1
_TYPE_tag2member_t
*
tag2el
;
asn_TYPE_tag2member_t
*
tag2el
;
int
tag2el_count
;
/*
* Extensions-related stuff.
*/
int
extensible
;
/* Whether CHOICE is extensible */
}
asn
1
_CHOICE_specifics_t
;
}
asn_CHOICE_specifics_t
;
/*
* A set specialized functions dealing with the CHOICE type.
...
...
skeletons/constr_SEQUENCE.c
View file @
5e03376b
...
...
@@ -74,8 +74,8 @@
*/
static
int
_t2e_cmp
(
const
void
*
ap
,
const
void
*
bp
)
{
const
asn
1_TYPE_tag2member_t
*
a
=
(
const
asn1
_TYPE_tag2member_t
*
)
ap
;
const
asn
1_TYPE_tag2member_t
*
b
=
(
const
asn1
_TYPE_tag2member_t
*
)
bp
;
const
asn
_TYPE_tag2member_t
*
a
=
(
const
asn
_TYPE_tag2member_t
*
)
ap
;
const
asn
_TYPE_tag2member_t
*
b
=
(
const
asn
_TYPE_tag2member_t
*
)
bp
;
int
a_class
=
BER_TAG_CLASS
(
a
->
el_tag
);
int
b_class
=
BER_TAG_CLASS
(
b
->
el_tag
);
...
...
@@ -108,22 +108,21 @@ _t2e_cmp(const void *ap, const void *bp) {
* The decoder of the SEQUENCE type.
*/
ber_dec_rval_t
SEQUENCE_decode_ber
(
asn
1
_TYPE_descriptor_t
*
td
,
SEQUENCE_decode_ber
(
asn
_codec_ctx_t
*
opt_codec_ctx
,
asn
_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
* Bring closer parts of structure description.
*/
asn
1_SEQUENCE_specifics_t
*
specs
=
(
asn1
_SEQUENCE_specifics_t
*
)
td
->
specifics
;
asn
1
_TYPE_member_t
*
elements
=
td
->
elements
;
asn
_SEQUENCE_specifics_t
*
specs
=
(
asn
_SEQUENCE_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
elements
=
td
->
elements
;
/*
* Parts of the structure being constructed.
*/
void
*
st
=
*
struct_ptr
;
/* Target structure. */
ber_dec
_ctx_t
*
ctx
;
/* Decoder context */
asn_struct
_ctx_t
*
ctx
;
/* Decoder context */
ber_tlv_tag_t
tlv_tag
;
/* T from TLV */
//ber_tlv_len_t tlv_len; /* L from TLV */
ber_dec_rval_t
rval
;
/* Return code from subparsers */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
...
...
@@ -144,7 +143,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Restore parsing context.
*/
ctx
=
(
ber_dec
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
ctx
=
(
asn_struct
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
/*
* Start to parse where left previously
...
...
@@ -157,7 +156,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *td,
* perfectly fits our expectations.
*/
rval
=
ber_check_tags
(
td
,
ctx
,
ptr
,
size
,
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
ctx
,
ptr
,
size
,
tag_mode
,
1
,
&
ctx
->
left
,
0
);
if
(
rval
.
code
!=
RC_OK
)
{
ASN_DEBUG
(
"%s tagging check failed: %d"
,
...
...
@@ -282,16 +281,16 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *td,
* Resort to a binary search over
* sorted array of tags.
*/
asn
1
_TYPE_tag2member_t
*
t2m
;
asn
1
_TYPE_tag2member_t
key
;
asn_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
key
;
key
.
el_tag
=
tlv_tag
;
key
.
el_no
=
edx
;
(
void
*
)
t2m
=
bsearch
(
&
key
,
specs
->
tag2el
,
specs
->
tag2el_count
,
sizeof
(
specs
->
tag2el
[
0
]),
_t2e_cmp
);
if
(
t2m
)
{
asn
1
_TYPE_tag2member_t
*
best
=
0
;
asn
1
_TYPE_tag2member_t
*
t2m_f
,
*
t2m_l
;
asn_TYPE_tag2member_t
*
best
=
0
;
asn_TYPE_tag2member_t
*
t2m_f
,
*
t2m_l
;
int
edx_max
=
edx
+
elements
[
edx
].
optional
;
/*
* Rewind to the first element with that tag,
...
...
@@ -397,7 +396,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Invoke the member fetch routine according to member's type
*/
rval
=
elements
[
edx
].
type
->
ber_decoder
(
rval
=
elements
[
edx
].
type
->
ber_decoder
(
opt_codec_ctx
,
elements
[
edx
].
type
,
memb_ptr2
,
ptr
,
LEFT
,
elements
[
edx
].
tag_mode
);
...
...
@@ -498,7 +497,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *td,
* The DER encoder of the SEQUENCE type.
*/
asn_enc_rval_t
SEQUENCE_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
SEQUENCE_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
size_t
computed_size
=
0
;
...
...
@@ -513,7 +512,7 @@ SEQUENCE_encode_der(asn1_TYPE_descriptor_t *td,
* Gather the length of the underlying members sequence.
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
ptr
+
elm
->
memb_offset
);
...
...
@@ -550,7 +549,7 @@ SEQUENCE_encode_der(asn1_TYPE_descriptor_t *td,
* Encode all members.
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_enc_rval_t
tmperval
;
void
*
memb_ptr
;
...
...
@@ -583,7 +582,7 @@ SEQUENCE_encode_der(asn1_TYPE_descriptor_t *td,
}
asn_enc_rval_t
SEQUENCE_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
SEQUENCE_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
...
...
@@ -597,7 +596,7 @@ SEQUENCE_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn_enc_rval_t
tmper
;
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
memb_ptr
;
const
char
*
mname
=
elm
->
name
;
unsigned
int
mlen
=
strlen
(
mname
);
...
...
@@ -627,7 +626,7 @@ SEQUENCE_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
SEQUENCE_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
SEQUENCE_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
int
edx
;
int
ret
;
...
...
@@ -640,7 +639,7 @@ SEQUENCE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
return
-
1
;
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
@@ -671,7 +670,7 @@ SEQUENCE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
void
SEQUENCE_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
contents_only
)
{
SEQUENCE_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
contents_only
)
{
int
edx
;
if
(
!
td
||
!
sptr
)
...
...
@@ -680,7 +679,7 @@ SEQUENCE_free(asn1_TYPE_descriptor_t *td, void *sptr, int contents_only) {
ASN_DEBUG
(
"Freeing %s as SEQUENCE"
,
td
->
name
);
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
sptr
+
elm
->
memb_offset
);
...
...
@@ -698,7 +697,7 @@ SEQUENCE_free(asn1_TYPE_descriptor_t *td, void *sptr, int contents_only) {
}
int
SEQUENCE_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
SEQUENCE_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
int
edx
;
...
...
@@ -713,7 +712,7 @@ SEQUENCE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
* Iterate over structure members and check their validity.
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
skeletons/constr_SEQUENCE.h
View file @
5e03376b
...
...
@@ -7,17 +7,17 @@
#include <asn_application.h>
typedef
struct
asn
1
_SEQUENCE_specifics_s
{
typedef
struct
asn_SEQUENCE_specifics_s
{
/*
* Target structure description.
*/
int
struct_size
;
/* Size of the target structure. */
int
ctx_offset
;
/* Offset of the
ber_dec
_ctx_t member */
int
ctx_offset
;
/* Offset of the
asn_struct
_ctx_t member */
/*
* Tags to members mapping table (sorted).
*/
asn
1
_TYPE_tag2member_t
*
tag2el
;
asn_TYPE_tag2member_t
*
tag2el
;
int
tag2el_count
;
/*
...
...
@@ -25,7 +25,7 @@ typedef struct asn1_SEQUENCE_specifics_s {
*/
int
ext_after
;
/* Extensions start after this member */
int
ext_before
;
/* Extensions stop before this member */
}
asn
1
_SEQUENCE_specifics_t
;
}
asn_SEQUENCE_specifics_t
;
/*
...
...
skeletons/constr_SEQUENCE_OF.c
View file @
5e03376b
...
...
@@ -10,10 +10,10 @@
* The DER encoder of the SEQUENCE OF type.
*/
asn_enc_rval_t
SEQUENCE_OF_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
SEQUENCE_OF_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn
1
_TYPE_member_t
*
elm
=
td
->
elements
;
asn_TYPE_member_t
*
elm
=
td
->
elements
;
A_SEQUENCE_OF
(
void
)
*
list
;
size_t
computed_size
=
0
;
ssize_t
encoding_size
=
0
;
...
...
@@ -84,12 +84,12 @@ SEQUENCE_OF_encode_der(asn1_TYPE_descriptor_t *td, void *ptr,
}
asn_enc_rval_t
SEQUENCE_OF_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
SEQUENCE_OF_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
asn
1_SET_OF_specifics_t
*
specs
=
(
asn1
_SET_OF_specifics_t
*
)
td
->
specifics
;
asn
1
_TYPE_member_t
*
element
=
td
->
elements
;
asn
_SET_OF_specifics_t
*
specs
=
(
asn
_SET_OF_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
element
=
td
->
elements
;
A_SEQUENCE_OF
(
void
)
*
list
;
const
char
*
mname
=
specs
->
as_XMLValueList
?
0
:
((
*
element
->
name
)
?
element
->
name
:
element
->
type
->
name
);
...
...
skeletons/constr_SET.c
View file @
5e03376b
...
...
@@ -70,8 +70,8 @@
*/
static
int
_t2e_cmp
(
const
void
*
ap
,
const
void
*
bp
)
{
const
asn
1_TYPE_tag2member_t
*
a
=
(
const
asn1
_TYPE_tag2member_t
*
)
ap
;
const
asn
1_TYPE_tag2member_t
*
b
=
(
const
asn1
_TYPE_tag2member_t
*
)
bp
;
const
asn
_TYPE_tag2member_t
*
a
=
(
const
asn
_TYPE_tag2member_t
*
)
ap
;
const
asn
_TYPE_tag2member_t
*
b
=
(
const
asn
_TYPE_tag2member_t
*
)
bp
;
int
a_class
=
BER_TAG_CLASS
(
a
->
el_tag
);
int
b_class
=
BER_TAG_CLASS
(
b
->
el_tag
);
...
...
@@ -97,22 +97,21 @@ _t2e_cmp(const void *ap, const void *bp) {
* The decoder of the SET type.
*/
ber_dec_rval_t
SET_decode_ber
(
asn
1
_TYPE_descriptor_t
*
td
,
SET_decode_ber
(
asn
_codec_ctx_t
*
opt_codec_ctx
,
asn
_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
* Bring closer parts of structure description.
*/
asn
1_SET_specifics_t
*
specs
=
(
asn1
_SET_specifics_t
*
)
td
->
specifics
;
asn
1
_TYPE_member_t
*
elements
=
td
->
elements
;
asn
_SET_specifics_t
*
specs
=
(
asn
_SET_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
elements
=
td
->
elements
;
/*
* Parts of the structure being constructed.
*/
void
*
st
=
*
struct_ptr
;
/* Target structure. */
ber_dec
_ctx_t
*
ctx
;
/* Decoder context */
asn_struct
_ctx_t
*
ctx
;
/* Decoder context */
ber_tlv_tag_t
tlv_tag
;
/* T from TLV */
//ber_tlv_len_t tlv_len; /* L from TLV */
ber_dec_rval_t
rval
;
/* Return code from subparsers */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
...
...
@@ -133,7 +132,7 @@ SET_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Restore parsing context.
*/
ctx
=
(
ber_dec
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
ctx
=
(
asn_struct
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
/*
* Start to parse where left previously
...
...
@@ -146,7 +145,7 @@ SET_decode_ber(asn1_TYPE_descriptor_t *td,
* perfectly fits our expectations.
*/
rval
=
ber_check_tags
(
td
,
ctx
,
ptr
,
size
,
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
ctx
,
ptr
,
size
,
tag_mode
,
1
,
&
ctx
->
left
,
0
);
if
(
rval
.
code
!=
RC_OK
)
{
ASN_DEBUG
(
"%s tagging check failed: %d"
,
...
...
@@ -235,8 +234,8 @@ SET_decode_ber(asn1_TYPE_descriptor_t *td,
* but is not strongly anticipated either.
*/
}
else
{
asn
1
_TYPE_tag2member_t
*
t2m
;
asn
1
_TYPE_tag2member_t
key
;
asn_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
key
;
key
.
el_tag
=
tlv_tag
;
(
void
*
)
t2m
=
bsearch
(
&
key
,
...
...
@@ -312,7 +311,7 @@ SET_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Invoke the member fetch routine according to member's type
*/
rval
=
elements
[
edx
].
type
->
ber_decoder
(
rval
=
elements
[
edx
].
type
->
ber_decoder
(
opt_codec_ctx
,
elements
[
edx
].
type
,
memb_ptr2
,
ptr
,
LEFT
,
elements
[
edx
].
tag_mode
);
...
...
@@ -435,14 +434,14 @@ SET_decode_ber(asn1_TYPE_descriptor_t *td,
* The DER encoder of the SET type.
*/
asn_enc_rval_t
SET_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
SET_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn
1_SET_specifics_t
*
specs
=
(
asn1
_SET_specifics_t
*
)
td
->
specifics
;
asn
_SET_specifics_t
*
specs
=
(
asn
_SET_specifics_t
*
)
td
->
specifics
;
size_t
computed_size
=
0
;
asn_enc_rval_t
my_erval
;
int
t2m_build_own
=
(
specs
->
tag2el_count
!=
td
->
elements_count
);
asn
1
_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
*
t2m
;
int
t2m_count
;
ssize_t
ret
;
int
edx
;
...
...
@@ -472,7 +471,7 @@ SET_encode_der(asn1_TYPE_descriptor_t *td,
* Gather the length of the underlying members sequence.
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_enc_rval_t
erval
;
void
*
memb_ptr
;
...
...
@@ -504,7 +503,7 @@ SET_encode_der(asn1_TYPE_descriptor_t *td,
*/
if
(
t2m_build_own
)
{
t2m
[
t2m_count
].
el_no
=
edx
;
t2m
[
t2m_count
].
el_tag
=
asn
1
_TYPE_outmost_tag
(
t2m
[
t2m_count
].
el_tag
=
asn_TYPE_outmost_tag
(
elm
->
type
,
memb_ptr
,
elm
->
tag_mode
,
elm
->
tag
);
t2m_count
++
;
}
else
{
...
...
@@ -548,7 +547,7 @@ SET_encode_der(asn1_TYPE_descriptor_t *td,
* Encode all members.
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
;
asn_TYPE_member_t
*
elm
;
asn_enc_rval_t
erval
;
void
*
memb_ptr
;
...
...
@@ -582,7 +581,7 @@ SET_encode_der(asn1_TYPE_descriptor_t *td,
}
asn_enc_rval_t
SET_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
SET_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
...
...
@@ -596,7 +595,7 @@ SET_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn_enc_rval_t
tmper
;
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
memb_ptr
;
const
char
*
mname
=
elm
->
name
;
unsigned
int
mlen
=
strlen
(
elm
->
name
);
...
...
@@ -628,7 +627,7 @@ SET_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
SET_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
SET_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
int
edx
;
int
ret
;
...
...
@@ -641,7 +640,7 @@ SET_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
return
-
1
;
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
@@ -671,7 +670,7 @@ SET_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
void
SET_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
SET_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
int
edx
;
if
(
!
td
||
!
ptr
)
...
...
@@ -680,7 +679,7 @@ SET_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
ASN_DEBUG
(
"Freeing %s as SET"
,
td
->
name
);
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
ptr
+
elm
->
memb_offset
);
...
...
@@ -698,7 +697,7 @@ SET_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
}
int
SET_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
SET_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
int
edx
;
...
...
@@ -713,7 +712,7 @@ SET_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
* Iterate over structure members and check their validity.
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn
1
_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
const
void
*
memb_ptr
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
...
...
skeletons/constr_SET.h
View file @
5e03376b
...
...
@@ -8,18 +8,18 @@
#include <asn_application.h>
typedef
struct
asn
1
_SET_specifics_s
{
typedef
struct
asn_SET_specifics_s
{
/*
* Target structure description.
*/
int
struct_size
;
/* Size of the target structure. */
int
ctx_offset
;
/* Offset of the
ber_dec
_ctx_t member */
int
ctx_offset
;
/* Offset of the
asn_struct
_ctx_t member */
int
pres_offset
;
/* Offset of _presence_map member */
/*
* Tags to members mapping table (sorted).
*/
asn
1
_TYPE_tag2member_t
*
tag2el
;
asn_TYPE_tag2member_t
*
tag2el
;
int
tag2el_count
;
/*
...
...
@@ -27,7 +27,7 @@ typedef struct asn1_SET_specifics_s {
*/
int
extensible
;
/* Whether SET is extensible */
unsigned
int
*
_mandatory_elements
;
/* Bitmask of mandatory ones */
}
asn
1
_SET_specifics_t
;
}
asn_SET_specifics_t
;
/*
* A set specialized functions dealing with the SET type.
...
...
skeletons/constr_SET_OF.c
View file @
5e03376b
...
...
@@ -65,22 +65,21 @@
* The decoder of the SET OF type.
*/
ber_dec_rval_t
SET_OF_decode_ber
(
asn
1
_TYPE_descriptor_t
*
td
,
SET_OF_decode_ber
(
asn
_codec_ctx_t
*
opt_codec_ctx
,
asn
_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
* Bring closer parts of structure description.
*/
asn
1_SET_OF_specifics_t
*
specs
=
(
asn1
_SET_OF_specifics_t
*
)
td
->
specifics
;
asn
1
_TYPE_member_t
*
element
=
td
->
elements
;
/* Single one */
asn
_SET_OF_specifics_t
*
specs
=
(
asn
_SET_OF_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
element
=
td
->
elements
;
/* Single one */
/*
* Parts of the structure being constructed.
*/
void
*
st
=
*
struct_ptr
;
/* Target structure. */
ber_dec
_ctx_t
*
ctx
;
/* Decoder context */
asn_struct
_ctx_t
*
ctx
;
/* Decoder context */
ber_tlv_tag_t
tlv_tag
;
/* T from TLV */
//ber_tlv_len_t tlv_len; /* L from TLV */
ber_dec_rval_t
rval
;
/* Return code from subparsers */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
...
...
@@ -100,7 +99,7 @@ SET_OF_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Restore parsing context.
*/
ctx
=
(
ber_dec
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
ctx
=
(
asn_struct
_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
/*
* Start to parse where left previously
...
...
@@ -113,7 +112,7 @@ SET_OF_decode_ber(asn1_TYPE_descriptor_t *td,
* perfectly fits our expectations.
*/
rval
=
ber_check_tags
(
td
,
ctx
,
ptr
,
size
,
rval
=
ber_check_tags
(
opt_codec_ctx
,
td
,
ctx
,
ptr
,
size
,
tag_mode
,
1
,
&
ctx
->
left
,
0
);
if
(
rval
.
code
!=
RC_OK
)
{
ASN_DEBUG
(
"%s tagging check failed: %d"
,
...
...
@@ -206,8 +205,8 @@ SET_OF_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Invoke the member fetch routine according to member's type
*/
rval
=
element
->
type
->
ber_decoder
(
element
->
type
,
&
ctx
->
ptr
,
ptr
,
LEFT
,
0
);
rval
=
element
->
type
->
ber_decoder
(
opt_codec_ctx
,
element
->
type
,
&
ctx
->
ptr
,
ptr
,
LEFT
,
0
);
ASN_DEBUG
(
"In %s SET OF %s code %d consumed %d"
,
td
->
name
,
element
->
type
->
name
,
rval
.
code
,
(
int
)
rval
.
consumed
);
...
...
@@ -310,11 +309,11 @@ static int _el_buf_cmp(const void *ap, const void *bp) {
* The DER encoder of the SET OF type.
*/
asn_enc_rval_t
SET_OF_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
SET_OF_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn
1
_TYPE_member_t
*
elm
=
td
->
elements
;
asn
1
_TYPE_descriptor_t
*
elm_type
=
elm
->
type
;
asn_TYPE_member_t
*
elm
=
td
->
elements
;
asn_TYPE_descriptor_t
*
elm_type
=
elm
->
type
;
der_type_encoder_f
*
der_encoder
=
elm_type
->
der_encoder
;
A_SET_OF
(
void
)
*
list
;
size_t
computed_size
=
0
;
...
...
@@ -451,12 +450,12 @@ SET_OF_encode_der(asn1_TYPE_descriptor_t *td, void *ptr,
}
asn_enc_rval_t
SET_OF_encode_xer
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
SET_OF_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
asn
1_SET_OF_specifics_t
*
specs
=
(
asn1
_SET_OF_specifics_t
*
)
td
->
specifics
;
asn
1
_TYPE_member_t
*
element
=
td
->
elements
;
asn
_SET_OF_specifics_t
*
specs
=
(
asn
_SET_OF_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
element
=
td
->
elements
;
A_SET_OF
(
void
)
*
list
;
const
char
*
mname
=
specs
->
as_XMLValueList
?
0
:
((
*
element
->
name
)
?
element
->
name
:
element
->
type
->
name
);
...
...
@@ -498,9 +497,9 @@ SET_OF_encode_xer(asn1_TYPE_descriptor_t *td, void *sptr,
}
int
SET_OF_print
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
SET_OF_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn
1
_TYPE_member_t
*
element
=
td
->
elements
;
asn_TYPE_member_t
*
element
=
td
->
elements
;
const
A_SET_OF
(
void
)
*
list
;
int
ret
;
int
i
;
...
...
@@ -531,9 +530,9 @@ SET_OF_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
}
void
SET_OF_free
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
SET_OF_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
if
(
td
&&
ptr
)
{
asn
1
_TYPE_member_t
*
element
=
td
->
elements
;
asn_TYPE_member_t
*
element
=
td
->
elements
;
A_SET_OF
(
void
)
*
list
;
int
i
;
...
...
@@ -558,9 +557,9 @@ SET_OF_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
}
int
SET_OF_constraint
(
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
SET_OF_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
app_errlog
,
void
*
app_key
)
{
asn
1
_TYPE_member_t
*
element
=
td
->
elements
;
asn_TYPE_member_t
*
element
=
td
->
elements
;
asn_constr_check_f
*
constr
;
const
A_SET_OF
(
void
)
*
list
;
int
i
;
...
...
skeletons/constr_SET_OF.h
View file @
5e03376b
...
...
@@ -7,16 +7,16 @@
#include <asn_application.h>
typedef
struct
asn
1
_SET_OF_specifics_s
{
typedef
struct
asn_SET_OF_specifics_s
{
/*
* Target structure description.
*/
int
struct_size
;
/* Size of the target structure. */
int
ctx_offset
;
/* Offset of the
ber_dec
_ctx_t member */
int
ctx_offset
;
/* Offset of the
asn_struct
_ctx_t member */
/* XER-specific stuff */
int
as_XMLValueList
;
/* The member type must be encoded like this */
}
asn
1
_SET_OF_specifics_t
;
}
asn_SET_OF_specifics_t
;
/*
* A set specialized functions dealing with the SET OF type.
...
...
skeletons/constr_TYPE.c
View file @
5e03376b
...
...
@@ -17,7 +17,7 @@ static asn_app_consume_bytes_f _print2fp;
* Return the outmost tag of the type.
*/
ber_tlv_tag_t
asn
1_TYPE_outmost_tag
(
asn1
_TYPE_descriptor_t
*
type_descriptor
,
asn
_TYPE_outmost_tag
(
asn
_TYPE_descriptor_t
*
type_descriptor
,
const
void
*
struct_ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
)
{
if
(
tag_mode
)
...
...
@@ -33,7 +33,7 @@ asn1_TYPE_outmost_tag(asn1_TYPE_descriptor_t *type_descriptor,
* Print the target language's structure in human readable form.
*/
int
asn_fprint
(
FILE
*
stream
,
asn
1
_TYPE_descriptor_t
*
td
,
const
void
*
struct_ptr
)
{
asn_fprint
(
FILE
*
stream
,
asn_TYPE_descriptor_t
*
td
,
const
void
*
struct_ptr
)
{
if
(
!
stream
)
stream
=
stdout
;
if
(
!
td
||
!
struct_ptr
)
{
errno
=
EINVAL
;
...
...
skeletons/constraints.c
View file @
5e03376b
...
...
@@ -2,7 +2,7 @@
#include <constraints.h>
int
asn_generic_no_constraint
(
asn
1
_TYPE_descriptor_t
*
type_descriptor
,
asn_generic_no_constraint
(
asn_TYPE_descriptor_t
*
type_descriptor
,
const
void
*
struct_ptr
,
asn_app_consume_bytes_f
*
cb
,
void
*
key
)
{
(
void
)
type_descriptor
;
/* Unused argument */
...
...
@@ -15,7 +15,7 @@ asn_generic_no_constraint(asn1_TYPE_descriptor_t *type_descriptor,
}
int
asn_generic_unknown_constraint
(
asn
1
_TYPE_descriptor_t
*
type_descriptor
,
asn_generic_unknown_constraint
(
asn_TYPE_descriptor_t
*
type_descriptor
,
const
void
*
struct_ptr
,
asn_app_consume_bytes_f
*
cb
,
void
*
key
)
{
(
void
)
type_descriptor
;
/* Unused argument */
...
...
@@ -54,7 +54,7 @@ __fill_errbuf(const void *buffer, size_t size, void *app_key) {
}
int
asn_check_constraints
(
asn
1
_TYPE_descriptor_t
*
type_descriptor
,
asn_check_constraints
(
asn_TYPE_descriptor_t
*
type_descriptor
,
const
void
*
struct_ptr
,
char
*
errbuf
,
size_t
*
errlen
)
{
if
(
errlen
)
{
...
...
skeletons/constraints.h
View file @
5e03376b
...
...
@@ -7,7 +7,7 @@
#include <asn_types.h>
/* System-dependent types */
struct
asn
1
_TYPE_descriptor_s
;
/* Forward declaration */
struct
asn_TYPE_descriptor_s
;
/* Forward declaration */
/*
* Validate the structure according to the ASN.1 constraints.
...
...
@@ -18,7 +18,7 @@ struct asn1_TYPE_descriptor_s; /* Forward declaration */
* to encode an error message (properly 0-terminated).
*/
int
asn_check_constraints
(
struct
asn
1
_TYPE_descriptor_s
*
type_descriptor
,
asn_check_constraints
(
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
const
void
*
struct_ptr
,
/* Target language's structure */
char
*
errbuf
,
/* Returned error description */
size_t
*
errlen
/* Length of the error description */
...
...
@@ -29,7 +29,7 @@ asn_check_constraints(struct asn1_TYPE_descriptor_s *type_descriptor,
* associated with every type descriptor.
*/
typedef
int
(
asn_constr_check_f
)(
struct
asn
1
_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
const
void
*
struct_ptr
,
asn_app_consume_bytes_f
*
optional_app_errlog
,
/* Log the error */
void
*
optional_app_key
/* Opaque key passed to app_errlog */
...
...
skeletons/der_encoder.c
View file @
5e03376b
...
...
@@ -13,7 +13,7 @@ static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len,
* The DER encoder of any type.
*/
asn_enc_rval_t
der_encode
(
asn
1
_TYPE_descriptor_t
*
type_descriptor
,
void
*
struct_ptr
,
der_encode
(
asn_TYPE_descriptor_t
*
type_descriptor
,
void
*
struct_ptr
,
asn_app_consume_bytes_f
*
consume_bytes
,
void
*
app_key
)
{
ASN_DEBUG
(
"DER encoder invoked for %s"
,
...
...
@@ -32,7 +32,7 @@ der_encode(asn1_TYPE_descriptor_t *type_descriptor, void *struct_ptr,
* Write out leading TL[v] sequence according to the type definition.
*/
ssize_t
der_write_tags
(
asn
1
_TYPE_descriptor_t
*
sd
,
der_write_tags
(
asn_TYPE_descriptor_t
*
sd
,
size_t
struct_length
,
int
tag_mode
,
int
last_tag_form
,
ber_tlv_tag_t
tag
,
/* EXPLICIT or IMPLICIT tag */
...
...
skeletons/der_encoder.h
View file @
5e03376b
...
...
@@ -7,12 +7,12 @@
#include <asn_application.h>
struct
asn
1
_TYPE_descriptor_s
;
/* Forward declaration */
struct
asn_TYPE_descriptor_s
;
/* Forward declaration */
/*
* The DER encoder of any type. May be invoked by the application.
*/
asn_enc_rval_t
der_encode
(
struct
asn
1
_TYPE_descriptor_s
*
type_descriptor
,
asn_enc_rval_t
der_encode
(
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
*
struct_ptr
,
/* Structure to be encoded */
asn_app_consume_bytes_f
*
consume_bytes_cb
,
void
*
app_key
/* Arbitrary callback argument */
...
...
@@ -22,7 +22,7 @@ asn_enc_rval_t der_encode(struct asn1_TYPE_descriptor_s *type_descriptor,
* Type of the generic DER encoder.
*/
typedef
asn_enc_rval_t
(
der_type_encoder_f
)(
struct
asn
1
_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
*
struct_ptr
,
/* Structure to be encoded */
int
tag_mode
,
/* {-1,0,1}: IMPLICIT, no, EXPLICIT */
ber_tlv_tag_t
tag
,
...
...
@@ -39,7 +39,7 @@ typedef asn_enc_rval_t (der_type_encoder_f)(
* Write out leading TL[v] sequence according to the type definition.
*/
ssize_t
der_write_tags
(
struct
asn
1
_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
size_t
struct_length
,
int
tag_mode
,
/* {-1,0,1}: IMPLICIT, no, EXPLICIT */
int
last_tag_form
,
/* {0,!0}: prim, constructed */
...
...
skeletons/tests/check-GeneralizedTime.c
View file @
5e03376b
...
...
@@ -98,7 +98,7 @@ main(int ac, char **av) {
*/
asn_enc_rval_t
OCTET_STRING_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
OCTET_STRING_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
erval
;
(
void
)
td
;
...
...
@@ -112,7 +112,7 @@ OCTET_STRING_encode_der(asn1_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber
}
asn_enc_rval_t
OCTET_STRING_encode_xer_ascii
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
OCTET_STRING_encode_xer_ascii
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
erval
;
(
void
)
td
;
...
...
skeletons/tests/check-INTEGER.c
View file @
5e03376b
...
...
@@ -38,14 +38,14 @@ check(uint8_t *buf, int size, long check_long, int check_ret) {
}
printf
(
"]: "
);
ret
=
asn
1
_INTEGER2long
(
&
val
,
&
rlong
);
ret
=
asn_INTEGER2long
(
&
val
,
&
rlong
);
printf
(
" (%ld, %d) vs (%ld, %d)
\n
"
,
rlong
,
ret
,
check_long
,
check_ret
);
assert
(
ret
==
check_ret
);
assert
(
rlong
==
check_long
);
shared_scratch_start
=
scratch
;
ret
=
INTEGER_print
(
&
asn
1
_DEF_INTEGER
,
&
val
,
0
,
_print2buf
,
scratch
);
ret
=
INTEGER_print
(
&
asn_DEF_INTEGER
,
&
val
,
0
,
_print2buf
,
scratch
);
assert
(
shared_scratch_start
<
scratch
+
sizeof
(
scratch
));
assert
(
ret
==
0
);
ret
=
snprintf
(
verify
,
sizeof
(
verify
),
"%ld"
,
check_long
);
...
...
skeletons/tests/check-OIDs.c
View file @
5e03376b
...
...
@@ -31,7 +31,7 @@ check_OID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
printf
(
"}
\n
"
);
oid
=
NULL
;
rval
=
ber_decode
(
&
asn1
_DEF_OBJECT_IDENTIFIER
,
(
void
*
)
&
oid
,
buf
,
len
);
rval
=
ber_decode
(
0
,
&
asn
_DEF_OBJECT_IDENTIFIER
,
(
void
*
)
&
oid
,
buf
,
len
);
assert
(
rval
.
code
==
RC_OK
);
assert
(
oid
->
size
==
(
ssize_t
)
len
-
2
);
...
...
@@ -40,7 +40,7 @@ check_OID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
* Print the contents for visual debugging.
*/
printf
(
"OBJECT_IDENTIFIER_print() => "
);
OBJECT_IDENTIFIER_print
(
&
asn
1
_DEF_OBJECT_IDENTIFIER
,
oid
,
0
,
_print
,
0
);
OBJECT_IDENTIFIER_print
(
&
asn_DEF_OBJECT_IDENTIFIER
,
oid
,
0
,
_print
,
0
);
printf
(
"
\n
"
);
memset
(
arcs
,
'A'
,
sizeof
(
arcs
));
...
...
@@ -78,7 +78,7 @@ check_ROID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
printf
(
"}
\n
"
);
oid
=
NULL
;
rval
=
ber_decode
(
&
asn1
_DEF_RELATIVE_OID
,
(
void
*
)
&
oid
,
buf
,
len
);
rval
=
ber_decode
(
0
,
&
asn
_DEF_RELATIVE_OID
,
(
void
*
)
&
oid
,
buf
,
len
);
assert
(
rval
.
code
==
RC_OK
);
assert
(
oid
->
size
==
(
ssize_t
)
len
-
2
);
...
...
@@ -87,7 +87,7 @@ check_ROID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
* Print the contents for visual debugging.
*/
printf
(
"RELATIVE_OID_print() => "
);
RELATIVE_OID_print
(
&
asn
1
_DEF_RELATIVE_OID
,
oid
,
0
,
_print
,
0
);
RELATIVE_OID_print
(
&
asn_DEF_RELATIVE_OID
,
oid
,
0
,
_print
,
0
);
printf
(
"
\n
"
);
memset
(
arcs
,
'A'
,
sizeof
(
arcs
));
...
...
skeletons/tests/check-REAL.c
View file @
5e03376b
...
...
@@ -69,7 +69,7 @@ check(REAL_t *rn, double orig_dbl, const char *sample, const char *canonical_sam
printf
(
"%02x"
,
*
p
);
printf
(
"]
\n
"
);
ret
=
asn
1
_double2REAL
(
rn
,
orig_dbl
);
ret
=
asn_double2REAL
(
rn
,
orig_dbl
);
assert
(
ret
==
0
);
printf
(
"converted into ["
);
...
...
@@ -77,7 +77,7 @@ check(REAL_t *rn, double orig_dbl, const char *sample, const char *canonical_sam
printf
(
"%02x"
,
*
p
);
printf
(
"]: %d
\n
"
,
rn
->
size
);
ret
=
asn
1
_REAL2double
(
rn
,
&
val
);
ret
=
asn_REAL2double
(
rn
,
&
val
);
assert
(
ret
==
0
);
printf
(
"and back to double: ["
);
...
...
@@ -114,7 +114,7 @@ check_buf(uint8_t *buf, size_t bufsize, double verify, const char *sample, const
rn
.
buf
=
0
;
rn
.
size
=
0
;
ret
=
asn
1
_double2REAL
(
&
rn
,
verify
);
ret
=
asn_double2REAL
(
&
rn
,
verify
);
assert
(
ret
==
0
);
printf
(
"canonical DER: ["
);
...
...
@@ -130,7 +130,7 @@ check_buf(uint8_t *buf, size_t bufsize, double verify, const char *sample, const
printf
(
"%02x"
,
*
p
);
printf
(
"]
\n
"
);
ret
=
asn
1
_REAL2double
(
&
rn
,
&
val
);
ret
=
asn_REAL2double
(
&
rn
,
&
val
);
assert
(
ret
==
0
);
printf
(
"%.12f vs %.12f
\n
"
,
verify
,
val
);
...
...
skeletons/tests/check-UTCTime.c
View file @
5e03376b
...
...
@@ -65,7 +65,7 @@ main(int ac, char **av) {
*/
asn_enc_rval_t
OCTET_STRING_encode_der
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
OCTET_STRING_encode_der
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
erval
;
(
void
)
td
;
...
...
@@ -79,7 +79,7 @@ OCTET_STRING_encode_der(asn1_TYPE_descriptor_t *td, void *ptr, int tag_mode, ber
}
asn_enc_rval_t
OCTET_STRING_encode_xer_ascii
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
OCTET_STRING_encode_xer_ascii
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
erval
;
(
void
)
td
;
...
...
skeletons/xer_encoder.c
View file @
5e03376b
...
...
@@ -11,7 +11,7 @@
* The XER encoder of any type. May be invoked by the application.
*/
asn_enc_rval_t
xer_encode
(
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
,
xer_encode
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
enum
xer_encoder_flags_e
xer_flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
,
tmper
;
...
...
@@ -56,7 +56,7 @@ xer__print2fp(const void *buffer, size_t size, void *app_key) {
}
int
xer_fprint
(
FILE
*
stream
,
asn
1
_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
xer_fprint
(
FILE
*
stream
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
)
{
asn_enc_rval_t
er
;
if
(
!
stream
)
stream
=
stdout
;
...
...
skeletons/xer_encoder.h
View file @
5e03376b
...
...
@@ -7,7 +7,7 @@
#include <asn_application.h>
struct
asn
1
_TYPE_descriptor_s
;
/* Forward declaration */
struct
asn_TYPE_descriptor_s
;
/* Forward declaration */
/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */
enum
xer_encoder_flags_e
{
...
...
@@ -19,7 +19,7 @@ enum xer_encoder_flags_e {
/*
* The XER encoder of any type. May be invoked by the application.
*/
asn_enc_rval_t
xer_encode
(
struct
asn
1
_TYPE_descriptor_s
*
type_descriptor
,
asn_enc_rval_t
xer_encode
(
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
*
struct_ptr
,
/* Structure to be encoded */
enum
xer_encoder_flags_e
xer_flags
,
asn_app_consume_bytes_f
*
consume_bytes_cb
,
...
...
@@ -34,13 +34,13 @@ asn_enc_rval_t xer_encode(struct asn1_TYPE_descriptor_s *type_descriptor,
* -1: Problem printing the structure.
* WARNING: No sensible errno value is returned.
*/
int
xer_fprint
(
FILE
*
stream
,
struct
asn
1
_TYPE_descriptor_s
*
td
,
void
*
sptr
);
int
xer_fprint
(
FILE
*
stream
,
struct
asn_TYPE_descriptor_s
*
td
,
void
*
sptr
);
/*
* Type of the generic XER encoder.
*/
typedef
asn_enc_rval_t
(
xer_type_encoder_f
)(
struct
asn
1
_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
*
struct_ptr
,
/* Structure to be encoded */
int
ilevel
,
/* Level of indentation */
enum
xer_encoder_flags_e
xer_flags
,
...
...
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