rules.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or
  8. * without modification, are permitted (subject to the limitations
  9. * in the disclaimer below) provided that the following conditions
  10. * are met:
  11. *
  12. * * Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * * Redistributions in binary form must reproduce the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer in the documentation and/or other materials
  18. * provided with the distribution.
  19. *
  20. * * Neither the name of Qualcomm Atheros nor the names of
  21. * its contributors may be used to endorse or promote products
  22. * derived from this software without specific prior written
  23. * permission.
  24. *
  25. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  26. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
  27. * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  28. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  29. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  30. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  31. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  32. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  33. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  34. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  37. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. *--------------------------------------------------------------------*/
  41. /*====================================================================*
  42. *
  43. * rules.c - Classification Rules Lookup Tables;
  44. *
  45. * rules.h
  46. *
  47. * QoS related symbol tables used by function ParseRule;
  48. *
  49. * Contributor(s):
  50. * Charles Maier
  51. * Nathaniel Houghton
  52. *
  53. *--------------------------------------------------------------------*/
  54. #ifndef RULES_SOURCE
  55. #define RULES_SOURCE
  56. #include "../plc/rules.h"
  57. struct _code_ const controls [] =
  58. {
  59. {
  60. CONTROL_ADD,
  61. "Add"
  62. },
  63. {
  64. CONTROL_REM,
  65. "Rem"
  66. },
  67. {
  68. CONTROL_REMOVE,
  69. "Remove"
  70. }
  71. };
  72. struct _code_ const volatilities [] =
  73. {
  74. {
  75. VOLATILITY_TEMP,
  76. "Temp"
  77. },
  78. {
  79. VOLATILITY_PERM,
  80. "Perm"
  81. }
  82. };
  83. struct _code_ const actions [] =
  84. {
  85. {
  86. ACTION_CAP0,
  87. "CAP0"
  88. },
  89. {
  90. ACTION_CAP1,
  91. "CAP1"
  92. },
  93. {
  94. ACTION_CAP2,
  95. "CAP2"
  96. },
  97. {
  98. ACTION_CAP3,
  99. "CAP3"
  100. },
  101. {
  102. ACTION_BOOST,
  103. "Boost"
  104. },
  105. {
  106. ACTION_DROP,
  107. "Drop"
  108. },
  109. {
  110. ACTION_DROPTX,
  111. "DropTX"
  112. },
  113. {
  114. ACTION_DROPRX,
  115. "DropRX"
  116. },
  117. {
  118. ACTION_AUTOCONNECT,
  119. "AutoConnect"
  120. },
  121. {
  122. ACTION_STRIPTX,
  123. "StripTX"
  124. },
  125. {
  126. ACTION_STRIPRX,
  127. "StripRX"
  128. },
  129. {
  130. ACTION_TAGTX,
  131. "TagTX"
  132. },
  133. {
  134. ACTION_TAGRX,
  135. "TagRX"
  136. }
  137. };
  138. struct _code_ const operands [] =
  139. {
  140. {
  141. OPERAND_ALL,
  142. "All"
  143. },
  144. {
  145. OPERAND_ANY,
  146. "Any"
  147. },
  148. {
  149. OPERAND_ALWAYS,
  150. "Always"
  151. }
  152. };
  153. struct _code_ const fields [] =
  154. {
  155. {
  156. FIELD_ETH_DA,
  157. "EthDA"
  158. },
  159. {
  160. FIELD_ETH_SA,
  161. "EthSA"
  162. },
  163. {
  164. FIELD_VLAN_UP,
  165. "VLANUP"
  166. },
  167. {
  168. FIELD_VLAN_ID,
  169. "VLANID"
  170. },
  171. {
  172. FIELD_IPV4_TOS,
  173. "IPv4TOS"
  174. },
  175. {
  176. FIELD_IPV4_PROT,
  177. "IPv4PROT"
  178. },
  179. {
  180. FIELD_IPV4_SA,
  181. "IPv4SA"
  182. },
  183. {
  184. FIELD_IPV4_DA,
  185. "IPv4DA"
  186. },
  187. {
  188. FIELD_IPV6_TC,
  189. "IPv6TC"
  190. },
  191. {
  192. FIELD_IPV6_FL,
  193. "IPv6FL"
  194. },
  195. {
  196. FIELD_IPV6_SA,
  197. "IPv6SA"
  198. },
  199. {
  200. FIELD_IPV6_DA,
  201. "IPv6DA"
  202. },
  203. {
  204. FIELD_TCP_SP,
  205. "TCPSP"
  206. },
  207. {
  208. FIELD_TCP_DP,
  209. "TCPDP"
  210. },
  211. {
  212. FIELD_UDP_SP,
  213. "UDPSP"
  214. },
  215. {
  216. FIELD_UDP_DP,
  217. "UDPDP"
  218. },
  219. {
  220. FIELD_IP_SP,
  221. "IPSP"
  222. },
  223. {
  224. FIELD_IP_DP,
  225. "IPDP"
  226. },
  227. {
  228. FIELD_HPAV_MME,
  229. "MME"
  230. },
  231. {
  232. FIELD_ETH_TYPE,
  233. "ET"
  234. },
  235. {
  236. FIELD_TCP_ACK,
  237. "TCPAck"
  238. },
  239. {
  240. FIELD_VLAN_TAG,
  241. "VLANTag"
  242. }
  243. };
  244. struct _code_ const operators [] =
  245. {
  246. {
  247. OPERATOR_IS,
  248. "Is"
  249. },
  250. {
  251. OPERATOR_NOT,
  252. "Not"
  253. }
  254. };
  255. struct _code_ const states [] =
  256. {
  257. {
  258. OPERATOR_IS,
  259. "True"
  260. },
  261. {
  262. OPERATOR_NOT,
  263. "False"
  264. },
  265. {
  266. OPERATOR_IS,
  267. "On"
  268. },
  269. {
  270. OPERATOR_NOT,
  271. "Off"
  272. },
  273. {
  274. OPERATOR_IS,
  275. "Yes"
  276. },
  277. {
  278. OPERATOR_NOT,
  279. "No"
  280. },
  281. {
  282. OPERATOR_IS,
  283. "Present"
  284. },
  285. {
  286. OPERATOR_NOT,
  287. "Missing"
  288. }
  289. };
  290. #endif