Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Havar
asn1c
Commits
5e03376b
Commit
5e03376b
authored
Sep 29, 2004
by
Lev Walkin
Browse files
asn1_* renamed into asn_*
parent
c4e4b684
Changes
79
Hide whitespace changes
Inline
Side-by-side
skeletons/ANY.c
View file @
5e03376b
...
...
@@ -7,7 +7,7 @@
#include <assert.h>
#include <errno.h>
asn
1
_TYPE_descriptor_t
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
(
asn
1
_DEF_BOOLEAN_tags
[
0
]),
asn
1
_DEF_BOOLEAN_tags
,
/* Same as above */
sizeof
(
asn
1
_DEF_BOOLEAN_tags
)
/
sizeof
(
asn
1
_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
asn
1
_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
asn
1
_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
(
asn
1
_DEF_ENUMERATED_tags
[
0
]),
asn
1
_DEF_ENUMERATED_tags
,
/* Same as above */
sizeof
(
asn
1
_DEF_ENUMERATED_tags
)
/
sizeof
(
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
asn
1
_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
(
asn
1
_DEF_INTEGER_tags
[
0
]),
asn
1
_DEF_INTEGER_tags
,
/* Same as above */
sizeof
(
asn
1
_DEF_INTEGER_tags
)
/
sizeof
(
asn
1
_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
,