#!/bin/bash -e

echo "/* autogenerated by mk-iana-dns-types.sh at `date --iso-8601=seconds -u` */"
curl -s https://www.iana.org/assignments/dns-parameters/dns-parameters-4.csv | \
  sed 's%^\*%ANY%' | \
  egrep '^\w+,[0-9]+,' | \
  grep -v -e '^Unassigned' -e '^Reserved' | \
  cut -d , -f 1,2 | \
  sed 's%,% %' | \
  while read type num; do
    echo -e "#ifndef T_$type\n#define T_$type $num\n#endif";
  done