1#/bin/sh
2RFCs="5280 5208 3369 3161 2986 4211 4210 8017 4511"
3downloadRFC() {
4 URL="https://www.ietf.org/rfc/rfc$1.txt"
5 if [ -x /usr/bin/fetch ]; then
6 /usr/bin/fetch -m --no-verify-peer $URL
7 elif [ -x /usr/bin/wget ]; then
8 /usr/bin/wget -N --no-check-certificate $URL
9 elif [ ! -r dumpasn1.cfg ]; then
10 echo Please download $URL in this directory.
11 exit 1
12 fi
13}
14echo '{}' > rfcdef.json # start from scratch
15mkdir -p rfc
16cd rfc
17for n in $RFCs; do
18 downloadRFC $n
19 ../parseRFC.js rfc$n.txt ../rfcdef.json
20done
21cd ..
22{
23 echo "// content parsed from ASN.1 definitions as found in the following RFCs: $RFCs"
24 echo "// Copyright (C) The IETF Trust (2008)"
25 echo "// as far as I can tell this file is allowed under the following clause:"
26 echo "// It is acceptable under the current IETF rules (RFC 5378) to modify extracted code if necessary."
27 echo "// https://trustee.ietf.org/about/faq/#reproducing-rfcs"
28 echo -n "export const rfcdef = "
29 cat rfcdef.json
30 echo ";"
31} > rfcdef.js
32echo Conversion completed.