generate-settings.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh -e
  2. # vim: ai ts=4 sts=4 et sw=4
  3. # This script generates an HTML file which contains an overview of all
  4. # configuration settings supported by DOCSIS, as defined in
  5. # ../src/docsis_symtable.h.
  6. if test $# -ne 2; then
  7. echo "Usage: $0 <output_file> <package_version>"
  8. exit 1;
  9. fi
  10. cat > $1 << EOF
  11. <?xml version="1.0" encoding="utf-8"?>
  12. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  13. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <title>DOCSIS Configuration Settings</title>
  17. </head>
  18. <body>
  19. <h1>DOCSIS Configuration Settings</h1>
  20. <p>In the table below you can find a list of all configuration settings understood by this program. The name should be self-descriptive; if not you can refer to the Appendix C of the DOCSIS RFI Specification for detailed explanations of what each of these mean.</p>
  21. <p>For String and Hexadecimal Strings, the "Range" is the minimum and maximum length of the string. For "List" types, it represents the number of elements in the list.</p>
  22. <p>This list was generated for docsis version $2.</p>
  23. <table cellpadding="5">
  24. <tr><td><b>Configuration Setting</b></td><td><b>Type</b></td><td><b>Range of values allowed</b></td></tr>
  25. EOF
  26. grep -e "^{" ../src/docsis_symtable.h \
  27. | grep -v "\"/\*" \
  28. | grep -v "decode_md5" \
  29. | awk '{print $5 "_" $3 " " $7 " " $8 " " $9}' \
  30. | sed 's/\"//g' \
  31. | sed 's/^0,_//g' \
  32. | sed 's/^[0-9]*,_/\&nbsp\;\&nbsp\;\&nbsp\;\&nbsp\;/g' \
  33. | sed 's/\decode_//g' \
  34. | sed 's/\ //g' | tr -s "\(\)" "%%" \
  35. | sed 's/^/<tr><td><b>/g' \
  36. | sed 's/,\%/<\/b><\/td><td>/g' \
  37. | sed 's/%,/<\/td><td>/g' \
  38. | sed 's/,/-/g' \
  39. | sed 's/$/<\/td><\/tr>/g'\
  40. | sed 's/uchar/Unsigned Integer/g' \
  41. | sed 's/uint/Unsigned Integer/g' \
  42. | sed 's/ushort_list/Unsigned Integer List - comma separated/g' \
  43. | sed 's/ushort/Unsigned Integer/g' \
  44. | sed 's/0xFFFFFFFF/4294967296/g' \
  45. | sed 's/ip/IP address/g' \
  46. | sed 's/ether/Ethernet MAC address/g' \
  47. | sed 's/ethermask/Ethernet MAC address mask/g' \
  48. | sed 's/hexstr/Hexadecimal characters/g' \
  49. | sed 's/string/String - double quote delimited/g' \
  50. | sed 's/strzero/String - double quote delimited/g' \
  51. | sed 's/aggregate/Aggregate/g' \
  52. | sed 's/vspecific/Aggregate/g' \
  53. | sed 's/oid/SNMP Object Identifier - numeric/g' \
  54. | sed 's/snmp_wd/SNMP Write Control - OID, value/g' \
  55. | sed 's/snmp_object/SNMP MIB Object- OID, Type, Value/g' \
  56. | sed 's/0-0/Not Applicable/g' >> $1
  57. echo "</table></body></html>" >> $1