docsis_symtable.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /*
  2. * DOCSIS configuration file encoder.
  3. * Copyright (c) 2001 Cornel Ciocirlan, ctrl@users.sourceforge.net.
  4. * Copyright (c) 2002,2003,2004,2005 Evvolve Media SRL,office@evvolve.com
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * DOCSIS is a registered trademark of Cablelabs, http://www.cablelabs.com
  21. */
  22. /*
  23. change history
  24. 2004-07-29 fix bug # 970994 ... SubMgmtControl had wrong docsis code
  25. 2003-01-10 added three new TLV types for BPI+ (courtesy of Adrian Kwong)
  26. */
  27. #ifndef _DOCSIS_SYMTABLE_H
  28. #include "docsis_common.h"
  29. #include "docsis_decode.h"
  30. #include "docsis_encode.h"
  31. /*
  32. * encode_nothing is used for non-trivial settings, where the encoding functions
  33. * must have prototypes that don't match symbol_type (i.e. generic TLV, SNMP, etc).
  34. *
  35. * This is a list and a tree at the same time. The "parent_id" of each entry is a pointer to the
  36. * parent row in this table; ClassId for example has "6" as parent ID which is the index
  37. * in the table of ClassOfService
  38. */
  39. /*id "identifier" docsis_code parent_id encode_func decode_func low_limit high_limit */
  40. symbol_type symtable[NUM_IDENTIFIERS] = {
  41. { 0, "/* Pad */", 0, 0, (encode_nothing), (decode_special), 0, 0 },
  42. { 1, "DownstreamFrequency", 1, 0, (encode_uint), (decode_uint), 88000000, 860000000 },
  43. { 2, "UpstreamChannelId", 2, 0, (encode_uchar), (decode_uchar), 0, 255 },
  44. { 3, "NetworkAccess", 3, 0, (encode_uchar), (decode_uchar), 0, 1 },
  45. { 4, "CmMic", 6, 0, (encode_nothing), (decode_md5), 0, 0 },
  46. { 5, "CmtsMic", 7, 0, (encode_nothing), (decode_md5), 0, 0 },
  47. { 6, "ClassOfService", 4, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  48. { 7, "ClassID", 1, 6, (encode_uchar), (decode_uchar), 1, 16 },
  49. { 8, "MaxRateDown", 2, 6, (encode_uint), (decode_uint), 0, 52000000 },
  50. { 9, "MaxRateUp", 3, 6, (encode_uint), (decode_uint), 0, 10000000 },
  51. { 10, "PriorityUp", 4, 6, (encode_uchar), (decode_uchar), 0, 7 },
  52. { 11, "GuaranteedUp", 5, 6, (encode_uint), (decode_uint), 0, 10000000 },
  53. { 12, "MaxBurstUp", 6, 6, (encode_ushort), (decode_ushort), 0, 65535 },
  54. { 13, "PrivacyEnable", 7, 6, (encode_uchar), (decode_uchar), 0, 1 },
  55. { 14, "SwUpgradeFilename", 9, 0, (encode_string), (decode_string), 0, 0 },
  56. { 15, "SnmpWriteControl", 10, 0, (encode_nothing), (decode_snmp_wd), 0, 0 },
  57. { 16, "SnmpMibObject", 11, 0, (encode_nothing), (decode_snmp_object), 0, 0 },
  58. { 17, "CpeMacAddress", 14, 0, (encode_ether), (decode_ether), 0, 0 },
  59. { 18, "BaselinePrivacy", 17, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  60. { 19, "AuthTimeout", 1, 18, (encode_uint), (decode_uint), 1, 30 },
  61. { 20, "ReAuthTimeout", 2, 18, (encode_uint), (decode_uint), 1, 30 },
  62. { 21, "AuthGraceTime", 3, 18, (encode_uint), (decode_uint), 1, 6047999 },
  63. { 22, "OperTimeout", 4, 18, (encode_uint), (decode_uint), 1, 10 },
  64. { 23, "ReKeyTimeout", 5, 18, (encode_uint), (decode_uint), 1, 10 },
  65. { 24, "TEKGraceTime", 6, 18, (encode_uint), (decode_uint), 1, 302399 },
  66. { 25, "AuthRejectTimeout", 7, 18, (encode_uint), (decode_uint), 1, 600 },
  67. { 26, "MaxCPE", 18, 0, (encode_uchar), (decode_uchar), 1, 254 },
  68. { 27, "SwUpgradeServer", 21, 0, (encode_ip), (decode_ip), 0, 0 },
  69. /* DOCSIS 1.1-2.0 */
  70. { 28, "UsPacketClass", 22, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  71. { 29, "ClassifierRef", 1, 28, (encode_uchar), (decode_uchar), 1, 255 },
  72. { 30, "ClassifierId", 2, 28, (encode_ushort), (decode_ushort), 1, 65535 },
  73. { 31, "ServiceFlowRef", 3, 28, (encode_ushort), (decode_ushort), 1, 65535 },
  74. { 32, "ServiceFlowId", 4, 28, (encode_uint), (decode_uint), 1, 0xFFFFFFFF },
  75. { 33, "RulePriority", 5, 28, (encode_uchar), (decode_uchar), 0, 255 },
  76. { 34, "ActivationState", 6, 28, (encode_uchar), (decode_uchar), 0, 1 },
  77. { 35, "DscAction", 7, 28, (encode_uchar), (decode_uchar), 0, 2 },
  78. { 36, "IpPacketClassifier", 9, 28, (encode_nothing), (decode_aggregate), 0, 0 },
  79. { 37, "IpTos", 1, 36, (encode_hexstr), (decode_hexstr), 3, 3 },
  80. { 38, "IpProto", 2, 36, (encode_ushort), (decode_ushort), 0, 257 },
  81. { 39, "IpSrcAddr", 3, 36, (encode_ip), (decode_ip), 0, 0 },
  82. { 40, "IpSrcMask", 4, 36, (encode_ip), (decode_ip), 0, 0 },
  83. { 41, "IpDstAddr", 5, 36, (encode_ip), (decode_ip), 0, 0 },
  84. { 42, "IpDstMask", 6, 36, (encode_ip), (decode_ip), 0, 0 },
  85. { 43, "SrcPortStart", 7, 36, (encode_ushort), (decode_ushort), 0, 65535 },
  86. { 44, "SrcPortEnd", 8, 36, (encode_ushort), (decode_ushort), 0, 65535 },
  87. { 45, "DstPortStart", 9, 36, (encode_ushort), (decode_ushort), 0, 65535 },
  88. { 46, "DstPortEnd", 10, 36, (encode_ushort), (decode_ushort), 0, 65535 },
  89. { 47, "LLCPacketClassifier", 10, 28, (encode_nothing), (decode_aggregate), 0, 0 },
  90. { 48, "DstMacAddress", 1, 47, (encode_ethermask), (decode_ethermask), 0, 0 },
  91. { 49, "SrcMacAddress", 2, 47, (encode_ether), (decode_ether), 0, 0 },
  92. { 50, "EtherType", 3, 47, (encode_hexstr), (decode_hexstr), 3, 3 },
  93. { 51, "IEEE802Classifier", 11, 28, (encode_nothing), (decode_aggregate), 0, 0 },
  94. { 52, "UserPriority", 1, 51, (encode_ushort), (decode_ushort), 0, 0 },
  95. { 53, "VlanID", 2, 51, (encode_ushort), (decode_ushort), 0, 0 },
  96. /* TODO: Vendor Specific support in the IEEE802Classifier */
  97. { 54, "DsPacketClass", 23, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  98. { 55, "ClassifierRef", 1, 54, (encode_uchar), (decode_uchar), 1, 255 },
  99. { 56, "ClassifierId", 2, 54, (encode_ushort), (decode_ushort), 1, 65535 },
  100. { 57, "ServiceFlowRef", 3, 54, (encode_ushort), (decode_ushort), 1, 65535 },
  101. { 58, "ServiceFlowId", 4, 54, (encode_uint), (decode_uint), 1, 0xFFFFFFFF },
  102. { 59, "RulePriority", 5, 54, (encode_uchar), (decode_uchar), 0, 255 },
  103. { 60, "ActivationState", 6, 54, (encode_uchar), (decode_uchar), 0, 1 },
  104. { 61, "DscAction", 7, 54, (encode_uchar), (decode_uchar), 0, 2 },
  105. { 62, "IpPacketClassifier", 9, 54, (encode_nothing), (decode_aggregate), 0, 0 },
  106. { 63, "IpTos", 1, 62, (encode_hexstr), (decode_hexstr), 3, 3 },
  107. { 64, "IpProto", 2, 62, (encode_ushort), (decode_ushort), 0, 257 },
  108. { 65, "IpSrcAddr", 3, 62, (encode_ip), (decode_ip), 0, 0 },
  109. { 66, "IpSrcMask", 4, 62, (encode_ip), (decode_ip), 0, 0 },
  110. { 67, "IpDstAddr", 5, 62, (encode_ip), (decode_ip), 0, 0 },
  111. { 68, "IpDstMask", 6, 62, (encode_ip), (decode_ip), 0, 0 },
  112. { 69, "SrcPortStart", 7, 62, (encode_ushort), (decode_ushort), 0, 65535 },
  113. { 70, "SrcPortEnd", 8, 62, (encode_ushort), (decode_ushort), 0, 65535 },
  114. { 71, "DstPortStart", 9, 62, (encode_ushort), (decode_ushort), 0, 65535 },
  115. { 72, "DstPortEnd", 10, 62, (encode_ushort), (decode_ushort), 0, 65535 },
  116. { 73, "LLCPacketClassifier", 10, 54, (encode_nothing), (decode_aggregate), 0, 0 },
  117. { 74, "DstMacAddress", 1, 73, (encode_ethermask), (decode_ethermask), 0, 0 },
  118. { 75, "SrcMacAddress", 2, 73, (encode_ether), (decode_ether), 0, 0 },
  119. { 76, "EtherType", 3, 73, (encode_hexstr), (decode_hexstr), 0, 255 },
  120. { 77, "IEEE802Classifier", 11, 54, (encode_nothing), (decode_aggregate), 0, 0 },
  121. { 78, "UserPriority", 1, 77, (encode_ushort), (decode_ushort), 0, 0 },
  122. { 79, "VlanID", 2, 77, (encode_ushort), (decode_ushort), 0, 0 },
  123. /* Upstream Service Flow */
  124. { 80, "UsServiceFlow", 24, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  125. { 81, "UsServiceFlowRef", 1, 80, (encode_ushort), (decode_ushort), 1, 65535 },
  126. { 82, "UsServiceFlowId", 2, 80, (encode_uint), (decode_uint), 1, 0xFFFFFFFF },
  127. { 83, "ServiceClassName", 4, 80, (encode_strzero), (decode_strzero), 2, 16 },
  128. { 84, "QosParamSetType", 6, 80, (encode_uchar), (decode_uchar), 0, 255 },
  129. { 85, "TrafficPriority", 7, 80, (encode_uchar), (decode_uchar), 0, 7 },
  130. { 86, "MaxRateSustained", 8, 80, (encode_uint), (decode_uint), 0, 0 },
  131. { 87, "MaxTrafficBurst", 9, 80, (encode_uint), (decode_uint), 0, 0 },
  132. { 88, "MinReservedRate", 10, 80, (encode_uint), (decode_uint), 0, 0 },
  133. { 89, "MinResPacketSize", 11, 80, (encode_ushort), (decode_ushort), 0, 65535 },
  134. { 90, "ActQosParamsTimeout", 12, 80, (encode_ushort), (decode_ushort), 0, 65535 },
  135. { 91, "AdmQosParamsTimeout", 13, 80, (encode_ushort), (decode_ushort), 0, 65535 },
  136. /* Upstream Service Flow Specific params */
  137. { 92, "MaxConcatenatedBurst", 14, 80, (encode_ushort), (decode_ushort), 0, 65535 },
  138. { 93, "SchedulingType", 15, 80, (encode_uchar), (decode_uchar), 0, 6 },
  139. { 94, "RequestOrTxPolicy", 16, 80, (encode_hexstr), (decode_hexstr), 4, 4 },
  140. { 95, "NominalPollInterval", 17, 80, (encode_uint), (decode_uint), 0, 0 },
  141. { 96, "ToleratedPollJitter", 18, 80, (encode_uint), (decode_uint), 0, 0 },
  142. { 97, "UnsolicitedGrantSize", 19, 80, (encode_ushort), (decode_ushort), 0, 65535 },
  143. { 98, "NominalGrantInterval", 20, 80, (encode_uint), (decode_uint), 0, 0 },
  144. { 99, "ToleratedGrantJitter", 21, 80, (encode_uint), (decode_uint), 0, 0 },
  145. { 100, "GrantsPerInterval", 22, 80, (encode_uchar), (decode_uchar), 0, 127 },
  146. { 101, "IpTosOverwrite", 23, 80, (encode_hexstr), (decode_hexstr), 2, 2 },
  147. /* Downstream Service Flow */
  148. { 102, "DsServiceFlow", 25, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  149. { 103, "DsServiceFlowRef", 1, 102, (encode_ushort), (decode_ushort), 1, 65535 },
  150. { 104, "DsServiceFlowId", 2, 102, (encode_uint), (decode_uint), 1, 0xFFFFFFFF },
  151. { 105, "ServiceClassName", 4, 102, (encode_strzero), (decode_strzero), 2, 16 },
  152. { 106, "QosParamSetType", 6, 102, (encode_uchar), (decode_uchar), 0, 255 },
  153. { 107, "TrafficPriority", 7, 102, (encode_uchar), (decode_uchar), 0, 7 },
  154. { 108, "MaxRateSustained", 8, 102, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  155. { 109, "MaxTrafficBurst", 9, 102, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  156. { 110, "MinReservedRate", 10, 102, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  157. { 111, "MinResPacketSize", 11, 102, (encode_ushort), (decode_ushort), 0, 65535 },
  158. { 112, "ActQosParamsTimeout", 12, 102, (encode_ushort), (decode_ushort), 0, 65535 },
  159. { 113, "AdmQosParamsTimeout", 13, 102, (encode_ushort), (decode_ushort), 0, 65535 },
  160. /* Downstream Service Flow Specific Params */
  161. { 114, "MaxDsLatency", 14, 102, (encode_uint), (decode_uint), 0, 0 },
  162. /* Payload Header Suppression - Appendix C.2.2.8 */
  163. { 115, "PHS", 26, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  164. { 116, "PHSClassifierRef", 1, 115, (encode_uchar), (decode_uchar), 1, 255 },
  165. { 117, "PHSClassifierId", 2, 115, (encode_ushort), (decode_ushort), 1, 65535 },
  166. { 118, "PHSServiceFlowRef", 3, 115, (encode_ushort), (decode_ushort), 1, 65535 },
  167. { 119, "PHSServiceFlowId", 4, 115, (encode_uint), (decode_uint), 1, 0xFFFFFFFF },
  168. /* Payload Header Suppression Rule - Appendix C.2.2.10 */
  169. { 120, "PHSField", 7, 115, (encode_hexstr), (decode_hexstr), 1, 255 },
  170. { 121, "PHSIndex", 8, 115, (encode_uchar), (decode_uchar), 1, 255 },
  171. { 122, "PHSMask", 9, 115, (encode_hexstr), (decode_hexstr), 1, 255 },
  172. { 123, "PHSSize", 10, 115, (encode_uchar), (decode_uchar), 1, 255 },
  173. { 124, "PHSVerify", 11, 115, (encode_uchar), (decode_uchar), 0, 1 },
  174. { 125, "MaxClassifiers", 28, 0, (encode_ushort), (decode_ushort), 0, 0 },
  175. { 126, "GlobalPrivacyEnable", 29, 0, (encode_uchar), (decode_uchar), 0, 0 },
  176. /* BPI+ SubTLV's */
  177. { 127, "SAMapWaitTimeout", 8, 18, (encode_uint), (decode_uint), 1, 10 },
  178. { 128, "SAMapMaxRetries", 9, 18, (encode_uint), (decode_uint), 0, 10 },
  179. /* ManufacturerCVC */
  180. { 129, "MfgCVCData", 32, 0, (encode_hexstr), (decode_hexstr), 0, 255 },
  181. /* Vendor Specific */
  182. { 130, "VendorSpecific", 43, 0, (encode_nothing), (decode_vspecific), 0, 0 },
  183. { 131, "VendorIdentifier", 8, 130, (encode_hexstr), (decode_hexstr), 3, 3 },
  184. /* SNMPv3 Kickstart */
  185. { 132, "SnmpV3Kickstart", 34, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  186. /* TODO: SP-RFI-v2.0 says the SecurityName is UTF8 encoded */
  187. { 133, "SnmpV3SecurityName", 1, 132, (encode_string), (decode_string), 1, 16 },
  188. { 134, "SnmpV3MgrPublicNumber", 2, 132, (encode_hexstr), (decode_hexstr), 1, 514 },
  189. /* Snmpv3 Notification Receiver */
  190. { 135, "SnmpV3TrapReceiver", 38, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  191. { 136, "SnmpV3TrapRxIP", 1, 135, (encode_ip), (decode_ip), 0, 0 },
  192. { 137, "SnmpV3TrapRxPort", 2, 135, (encode_ushort), (decode_ushort), 0, 0 },
  193. { 138, "SnmpV3TrapRxType", 3, 135, (encode_ushort), (decode_ushort), 1, 5 },
  194. { 139, "SnmpV3TrapRxTimeout", 4, 135, (encode_ushort), (decode_ushort), 0, 65535 },
  195. { 140, "SnmpV3TrapRxRetries", 5, 135, (encode_ushort), (decode_ushort), 0, 65535 },
  196. { 141, "SnmpV3TrapRxFilterOID", 6, 135, (encode_oid), (decode_oid), 1, 5 },
  197. { 142, "SnmpV3TrapRxSecurityName", 7, 135, (encode_string), (decode_string), 1, 16 },
  198. { 143, "DocsisTwoEnable", 39, 0, (encode_uchar), (decode_uchar), 0, 1 },
  199. /* Modem Capabilities Encodings */
  200. { 144, "ModemCapabilities", 5, 0, (encode_nothing), (decode_aggregate), 0, 0 },
  201. { 145, "ConcatenationSupport", 1, 144, (encode_uchar), (decode_uchar), 0, 1 },
  202. { 146, "ModemDocsisVersion", 2, 144, (encode_uchar), (decode_uchar), 0, 2 },
  203. { 147, "FragmentationSupport", 3, 144, (encode_uchar), (decode_uchar), 0, 1 },
  204. { 148, "PHSSupport", 4, 144, (encode_uchar), (decode_uchar), 0, 1 },
  205. { 149, "IGMPSupport", 5, 144, (encode_uchar), (decode_uchar), 0, 1 },
  206. { 150, "BaselinePrivacySupport", 6, 144, (encode_uchar), (decode_uchar), 0, 1 },
  207. { 151, "DownstreamSAIDSupport", 7, 144, (encode_uchar), (decode_uchar), 0, 255 },
  208. { 152, "UpstreamSIDSupport", 8, 144, (encode_uchar), (decode_uchar), 0, 255 },
  209. { 153, "DCCSupport", 12, 144, (encode_uchar), (decode_uchar), 0, 1 },
  210. { 154, "SubMgmtControl", 35, 0, (encode_hexstr), (decode_hexstr), 3, 3 },
  211. { 155, "SubMgmtFilters", 37, 0, (encode_ushort_list), (decode_ushort_list), 4, 4 },
  212. { 156, "SnmpMibObject", 64, 0, (encode_nothing), (decode_snmp_object), 1, 2048 },
  213. /* PacketCable MTA Configuration File Delimiter */
  214. { 157, "MtaConfigDelimiter", 254, 0, (encode_uchar), (decode_uchar), 1, 255 },
  215. { 158, "DsChannelList", 41, 0, (encode_nothing), (decode_aggregate), 1, 255 },
  216. { 159, "SingleDsChannel", 1, 158, (encode_nothing), (decode_aggregate), 1, 255 },
  217. { 160, "SingleDsTimeout", 1, 159, (encode_ushort), (decode_ushort), 0, 65535 },
  218. { 161, "SingleDsFrequency", 2, 159, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  219. { 162, "DsFreqRange", 2, 158, (encode_nothing), (decode_aggregate), 1, 255 },
  220. { 163, "DsFreqRangeTimeout", 1, 162, (encode_ushort), (decode_ushort), 0, 65535 },
  221. { 164, "DsFreqRangeStart", 2, 162, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  222. { 165, "DsFreqRangeEnd", 3, 162, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  223. { 166, "DsFreqRangeStepSize", 4, 162, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  224. { 167, "DefaultScanTimeout", 3, 158, (encode_ushort), (decode_ushort), 0, 65535 },
  225. { 168, "TftpTimestamp", 19, 0, (encode_uint), (decode_uint), 0, 0xFFFFFFFF },
  226. { 169, "TftpModemAddress", 20, 0, (encode_ip), (decode_ip), 0, 0 },
  227. { 170, "ManufacturerCVC", 32, 0, (encode_nothing), (decode_hexstr), 0, 255 },
  228. { 171, "CoSignerCVCData", 33, 0, (encode_hexstr), (decode_hexstr), 0, 255 },
  229. { 172, "CoSignerCVC", 33, 0, (encode_nothing), (decode_hexstr), 0, 255 },
  230. /* Generic TLV ... we only use the limits, code and length don't matter ...*/
  231. { 998, "GenericTLV", 0, 0, (encode_nothing), (decode_special), 1, 255 },
  232. { 999, "/*EndOfDataMkr*/", 255, 0, (encode_nothing), (decode_special), 0, 0 }
  233. };
  234. #endif /* _DOCSIS_SYMTABLE_H */