mirror of https://gerrit.osmocom.org/asn1c
asn1_* renamed into asn_*
parent
c4e4b684a5
commit
5e03376b84
|
@ -7,7 +7,7 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
asn1_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(asn1_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, asn1_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(asn1_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, asn1_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;
|
||||
|
|
|
@ -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 asn1_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 *, asn1_TYPE_descriptor_t *td, void *struct_ptr);
|
||||
ANY_t *ANY_new_fromType(asn1_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 *, asn1_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))
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
/*
|
||||
* BIT STRING basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_BIT_STRING_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_BIT_STRING_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (3 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_BIT_STRING_tags,
|
||||
sizeof(asn1_DEF_BIT_STRING_tags)
|
||||
/ sizeof(asn1_DEF_BIT_STRING_tags[0]),
|
||||
asn1_DEF_BIT_STRING_tags, /* Same as above */
|
||||
sizeof(asn1_DEF_BIT_STRING_tags)
|
||||
/ sizeof(asn1_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(asn1_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(asn1_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(asn1_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];
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
typedef OCTET_STRING_t BIT_STRING_t; /* Implemented via OCTET STRING */
|
||||
|
||||
extern asn1_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;
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
/*
|
||||
* BMPString basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_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 */
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_BMPString_tags,
|
||||
sizeof(asn1_DEF_BMPString_tags)
|
||||
/ sizeof(asn1_DEF_BMPString_tags[0]) - 1,
|
||||
asn1_DEF_BMPString_tags,
|
||||
sizeof(asn1_DEF_BMPString_tags)
|
||||
/ sizeof(asn1_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(asn1_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(asn1_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;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
typedef OCTET_STRING_t BMPString_t; /* Implemented via OCTET STRING */
|
||||
|
||||
extern asn1_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;
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
/*
|
||||
* BOOLEAN basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_BOOLEAN_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (1 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_BOOLEAN_tags,
|
||||
sizeof(asn1_DEF_BOOLEAN_tags) / sizeof(asn1_DEF_BOOLEAN_tags[0]),
|
||||
asn1_DEF_BOOLEAN_tags, /* Same as above */
|
||||
sizeof(asn1_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(asn1_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(asn1_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(asn1_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(asn1_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);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
typedef int BOOLEAN_t;
|
||||
|
||||
extern asn1_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;
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
/*
|
||||
* ENUMERATED basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_ENUMERATED_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_ENUMERATED_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_ENUMERATED_tags,
|
||||
sizeof(asn1_DEF_ENUMERATED_tags) / sizeof(asn1_DEF_ENUMERATED_tags[0]),
|
||||
asn1_DEF_ENUMERATED_tags, /* Same as above */
|
||||
sizeof(asn1_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 */
|
||||
};
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
typedef INTEGER_t ENUMERATED_t; /* Implemented via INTEGER */
|
||||
|
||||
extern asn1_TYPE_descriptor_t asn1_DEF_ENUMERATED;
|
||||
extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED;
|
||||
|
||||
#endif /* _ENUMERATED_H_ */
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
/*
|
||||
* GeneralString basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_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 */
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_GeneralString_tags,
|
||||
sizeof(asn1_DEF_GeneralString_tags)
|
||||
/ sizeof(asn1_DEF_GeneralString_tags[0]) - 1,
|
||||
asn1_DEF_GeneralString_tags,
|
||||
sizeof(asn1_DEF_GeneralString_tags)
|
||||
/ sizeof(asn1_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 */
|
||||
};
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
typedef OCTET_STRING_t GeneralString_t; /* Implemented via OCTET STRING */
|
||||
|
||||
extern asn1_TYPE_descriptor_t asn1_DEF_GeneralString;
|
||||
extern asn_TYPE_descriptor_t asn_DEF_GeneralString;
|
||||
|
||||
#endif /* _GeneralString_H_ */
|
||||
|
|
|
@ -109,12 +109,12 @@ static time_t timegm(struct tm *tm) {
|
|||
/*
|
||||
* GeneralizedTime basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_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 */
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_GeneralizedTime_tags,
|
||||
sizeof(asn1_DEF_GeneralizedTime_tags)
|
||||
/ sizeof(asn1_DEF_GeneralizedTime_tags[0]) - 2,
|
||||
asn1_DEF_GeneralizedTime_tags,
|
||||
sizeof(asn1_DEF_GeneralizedTime_tags)
|
||||
/ sizeof(asn1_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(asn1_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(asn1_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(asn1_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(asn1_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 {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
typedef OCTET_STRING_t GeneralizedTime_t; /* Implemented via OCTET STRING */
|
||||
|
||||
extern asn1_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 *,
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
/*
|
||||
* GraphicString basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_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 */
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_GraphicString_tags,
|
||||
sizeof(asn1_DEF_GraphicString_tags)
|
||||
/ sizeof(asn1_DEF_GraphicString_tags[0]) - 1,
|
||||
asn1_DEF_GraphicString_tags,
|
||||
sizeof(asn1_DEF_GraphicString_tags)
|
||||
/ sizeof(asn1_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 */
|
||||
};
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
|
||||
typedef OCTET_STRING_t GraphicString_t; /* Implemented via OCTET STRING */
|
||||
|
||||
extern asn1_TYPE_descriptor_t asn1_DEF_GraphicString;
|
||||
extern asn_TYPE_descriptor_t asn_DEF_GraphicString;
|
||||
|
||||
#endif /* _GraphicString_H_ */
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
/*
|
||||
* IA5String basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_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 */
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_IA5String_tags,
|
||||
sizeof(asn1_DEF_IA5String_tags)
|
||||
/ sizeof(asn1_DEF_IA5String_tags[0]) - 1,
|
||||
asn1_DEF_IA5String_tags,
|
||||
sizeof(asn1_DEF_IA5String_tags)
|
||||
/ sizeof(asn1_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(asn1_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;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef OCTET_STRING_t IA5String_t; /* Implemented via OCTET STRING */
|
|||
/*
|
||||
* IA5String ASN.1 type definition.
|
||||
*/
|
||||
extern asn1_TYPE_descriptor_t asn1_DEF_IA5String;
|
||||
extern asn_TYPE_descriptor_t asn_DEF_IA5String;
|
||||
|
||||
asn_constr_check_f IA5String_constraint;
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
/*
|
||||
* INTEGER basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_INTEGER_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_INTEGER_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_INTEGER_tags,
|
||||
sizeof(asn1_DEF_INTEGER_tags) / sizeof(asn1_DEF_INTEGER_tags[0]),
|
||||
asn1_DEF_INTEGER_tags, /* Same as above */
|
||||
sizeof(asn1_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(asn1_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(asn1_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(asn1_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
|
||||
asn1_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
asn_INTEGER2long(const INTEGER_t *iptr, long *lptr) {
|
||||
uint8_t *b, *end;
|
||||
size_t size;
|
||||
long l;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;
|
||||
|
||||
extern asn1_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 asn1_INTEGER2long(const INTEGER_t *i, long *l);
|
||||
int asn_INTEGER2long(const INTEGER_t *i, long *l);
|
||||
|
||||
#endif /* _INTEGER_H_ */
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
/*
|
||||
* ISO646String basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_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 */
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_ISO646String_tags,
|
||||
sizeof(asn1_DEF_ISO646String_tags)
|
||||
/ sizeof(asn1_DEF_ISO646String_tags[0]) - 1,
|
||||
asn1_DEF_ISO646String_tags,
|
||||
sizeof(asn1_DEF_ISO646String_tags)
|
||||
/ sizeof(asn1_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 */
|
||||
};
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
typedef VisibleString_t ISO646String_t; /* Implemented using VisibleString */
|
||||
|
||||
extern asn1_TYPE_descriptor_t asn1_DEF_ISO646String;
|
||||
extern asn_TYPE_descriptor_t asn_DEF_ISO646String;
|
||||
|
||||
#endif /* _ISO646String_H_ */
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
/*
|
||||
* NULL basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_NULL_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_NULL_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (5 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_NULL_tags,
|
||||
sizeof(asn1_DEF_NULL_tags) / sizeof(asn1_DEF_NULL_tags[0]),
|
||||
asn1_DEF_NULL_tags, /* Same as above */
|
||||
sizeof(asn1_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(asn1_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(asn1_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(asn1_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 */
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
typedef int NULL_t;
|
||||
|
||||
extern asn1_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;
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
/*
|
||||
* NativeEnumerated basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_NativeEnumerated_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_NativeEnumerated_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_NativeEnumerated_tags,
|
||||
sizeof(asn1_DEF_NativeEnumerated_tags) / sizeof(asn1_DEF_NativeEnumerated_tags[0]),
|
||||
asn1_DEF_NativeEnumerated_tags, /* Same as above */
|
||||
sizeof(asn1_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 */
|
||||
};
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
|
||||
#include <NativeInteger.h>
|
||||
|
||||
extern asn1_TYPE_descriptor_t asn1_DEF_NativeEnumerated;
|
||||
extern asn_TYPE_descriptor_t asn_DEF_NativeEnumerated;
|
||||
|
||||
#endif /* _NativeEnumerated_H_ */
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
/*
|
||||
* NativeInteger basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_NativeInteger_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_NativeInteger_tags,
|
||||
sizeof(asn1_DEF_NativeInteger_tags) / sizeof(asn1_DEF_NativeInteger_tags[0]),
|
||||
asn1_DEF_NativeInteger_tags, /* Same as above */
|
||||
sizeof(asn1_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(asn1_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(asn1_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(asn1_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(asn1_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(asn1_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;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <asn_application.h>
|
||||
|
||||
extern asn1_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;
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
/*
|
||||
* NativeReal basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_NativeReal_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_NativeReal_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (9 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_NativeReal_tags,
|
||||
sizeof(asn1_DEF_NativeReal_tags) / sizeof(asn1_DEF_NativeReal_tags[0]),
|
||||
asn1_DEF_NativeReal_tags, /* Same as above */
|
||||
sizeof(asn1_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(asn1_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(asn1_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(asn1_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(asn1_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(asn1_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(asn1_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;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <asn_application.h>
|
||||
|
||||
extern asn1_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;
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
/*
|
||||
* NumericString basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_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 */
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_NumericString_tags,
|
||||
sizeof(asn1_DEF_NumericString_tags)
|
||||
/ sizeof(asn1_DEF_NumericString_tags[0]) - 1,
|
||||
asn1_DEF_NumericString_tags,
|
||||
sizeof(asn1_DEF_NumericString_tags)
|
||||
/ sizeof(asn1_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(asn1_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;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
typedef OCTET_STRING_t NumericString_t; /* Implemented via OCTET STRING */
|
||||
|
||||
extern asn1_TYPE_descriptor_t asn1_DEF_NumericString;
|
||||
extern asn_TYPE_descriptor_t asn_DEF_NumericString;
|
||||
|
||||
asn_constr_check_f NumericString_constraint;
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
/*
|
||||
* OBJECT IDENTIFIER basic type description.
|
||||
*/
|
||||
static ber_tlv_tag_t asn1_DEF_OBJECT_IDENTIFIER_tags[] = {
|
||||
static ber_tlv_tag_t asn_DEF_OBJECT_IDENTIFIER_tags[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (6 << 2))
|
||||
};
|
||||
asn1_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 */
|
||||
asn1_DEF_OBJECT_IDENTIFIER_tags,
|
||||
sizeof(asn1_DEF_OBJECT_IDENTIFIER_tags)
|
||||
/ sizeof(asn1_DEF_OBJECT_IDENTIFIER_tags[0]),
|
||||
asn1_DEF_OBJECT_IDENTIFIER_tags, /* Same as above */
|
||||
sizeof(asn1_DEF_OBJECT_IDENTIFIER_tags)
|
||||
/ sizeof(asn1_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(asn1_TYPE_descriptor_t *td, const void *sptr,
|
||||
OBJECT_IDENTIFIER_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
|