Newer
Older
#!/bin/sh -e
# ----------------------------------------------------
# This script uses the Open Source asn1c to check all used ASN.1 modules
# are compile clean (no guarantee the generated code is valid).
#
# The used compile binary was built from here:
# https://github.com/brchiu/asn1c/commits/velichkov_s1ap_plus_option_group_plus_adding_trailing_ull
#
# The referenced ISO ASN.1 modules are pulled from the ISO Standards Maintenance Portal
# Yet not all are compile clean, thus minor fixed need to be done.
# All these changes are irrelevant for the resulting encoding.
# - Fixing duplicate DE tags
# - Fixing OID typo
# - Removing unused types (which bloat the IMPORTS)
# ----------------------------------------------------
# set -x
ASN_CACHE=".external"
mkdir -p ${ASN_CACHE}
if [ ! -f ${ASN_CACHE}/ISO19321IVIv2-patched.asn ]; then
wget -P ${ASN_CACHE} 'https://standards.iso.org/iso/ts/19321/ed-2/en/ISO19321IVIv2.asn'
sed -e 's/^FROM DSRC.*/FROM ETSI-ITS-DSRC { itu-t (0) identified-organization (4) etsi (0) itsDomain (5) wg1 (1) ts103301 (103301) dsrc (6) version2 (2) }/g' \
-e 's/^FROM ITS-Container.*/FROM ETSI-ITS-CDD { itu-t (0) identified-organization (4) etsi (0) itsDomain (5) wg1 (1) 102894 cdd (2) major-version-3 (3) minor-version-1 (1) }/g' \
${ASN_CACHE}/ISO19321IVIv2.asn > ${ASN_CACHE}/ISO19321IVIv2-patched.asn
fi
ASN1_SRC="\
DSRC-addgrp-C.asn \
DSRC-region.asn \
DSRC.asn \
cdd/ETSI-ITS-CDD.asn"
asnimports.py --verbose -o ${ASN_CACHE} ${ASN1_SRC} > ${ASN_CACHE}/dsrc-ext-modules
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
ASN1C_OPTIONS="-E -F -fcompound-names -fknown-extern-type=DATE"
asn1c ${ASN1C_OPTIONS} -pdu=SPATEM \
SPATEM-PDU-Descriptions.asn \
DSRC-addgrp-C.asn \
DSRC-region.asn \
DSRC.asn \
cdd/ETSI-ITS-CDD.asn \
$(cat ${ASN_CACHE}/dsrc-ext-modules) \
> /dev/null
asn1c ${ASN1C_OPTIONS} -pdu=MAPEM \
MAPEM-PDU-Descriptions.asn \
DSRC.asn \
DSRC-region.asn \
DSRC-addgrp-C.asn \
cdd/ETSI-ITS-CDD.asn \
$(cat ${ASN_CACHE}/dsrc-ext-modules) \
> /dev/null
asn1c ${ASN1C_OPTIONS} -pdu=SREM \
SREM-PDU-Descriptions.asn \
DSRC.asn \
DSRC-region.asn \
DSRC-addgrp-C.asn \
cdd/ETSI-ITS-CDD.asn \
$(cat ${ASN_CACHE}/dsrc-ext-modules) \
> /dev/null
asn1c ${ASN1C_OPTIONS} -pdu=SSEM \
SSEM-PDU-Descriptions.asn \
DSRC.asn \
DSRC-region.asn \
DSRC-addgrp-C.asn \
cdd/ETSI-ITS-CDD.asn \
$(cat ${ASN_CACHE}/dsrc-ext-modules) \
> /dev/null
asn1c ${ASN1C_OPTIONS} -pdu=RTCMEM \
RTCMEM-PDU-Descriptions.asn \
DSRC.asn \
DSRC-region.asn \
DSRC-addgrp-C.asn \
cdd/ETSI-ITS-CDD.asn \
$(cat ${ASN_CACHE}/dsrc-ext-modules) \
> /dev/null
asn1c ${ASN1C_OPTIONS} -pdu=IVIM \
IVIM-PDU-Descriptions.asn \
DSRC.asn \
DSRC-region.asn \
DSRC-addgrp-C.asn \
cdd/ETSI-ITS-CDD.asn \
${ASN_CACHE}/ISO19321IVIv2-patched.asn \
iso-patched/ISO14823-missing.asn \
'iso-patched/ISO14906(2018)EfcDsrcGenericv7-patched.asn' \
'iso-patched/ISO14906(2018)EfcDsrcApplicationv6-patched.asn' \
$(cat ${ASN_CACHE}/dsrc-ext-modules) \
> /dev/null
echo "++++++++++++++++++++++++"
echo "+++ SUCCESS"
echo "+++ All modules compiled"
echo "++++++++++++++++++++++++"