MMEName.c.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. MMEName.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='MMEMode.c.html' title=' MMEMode.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='MMEPeek.c.html' title=' MMEPeek.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  24. *
  25. * All rights reserved.
  26. *
  27. * Redistribution and use in source and binary forms, with or
  28. * without modification, are permitted (subject to the limitations
  29. * in the disclaimer below) provided that the following conditions
  30. * are met:
  31. *
  32. * * Redistributions of source code must retain the above copyright
  33. * notice, this list of conditions and the following disclaimer.
  34. *
  35. * * Redistributions in binary form must reproduce the above
  36. * copyright notice, this list of conditions and the following
  37. * disclaimer in the documentation and/or other materials
  38. * provided with the distribution.
  39. *
  40. * * Neither the name of Qualcomm Atheros nor the names of
  41. * its contributors may be used to endorse or promote products
  42. * derived from this software without specific prior written
  43. * permission.
  44. *
  45. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  46. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
  47. * COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR
  48. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  49. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  50. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  51. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  52. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  53. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  54. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  55. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  56. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  57. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  58. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  59. *
  60. *--------------------------------------------------------------------*/
  61. /*====================================================================*
  62. *
  63. * char const * MMEName (uint16_t MMTYPE);
  64. *
  65. * mme.h
  66. *
  67. * Return HomePlug or Atheros Management Message name for a given
  68. * MMTYPE; this function is not needed but it could be useful when
  69. * developing and debugging applications;
  70. *
  71. * If you add or remove items in this list then update constant
  72. * MMTYPES to reflect the number of list members;
  73. *
  74. *
  75. * Contributor(s):
  76. * Charles Maier &lt;cmaier@qca.qualcomm.com&gt;
  77. *
  78. *--------------------------------------------------------------------*/
  79. #ifndef MMENAME_SOURCE
  80. #define MMENAME_SOURCE
  81. #include &quot;../mme/mme.h&quot;
  82. static const struct mme_name
  83. {
  84. uint16_t type;
  85. char const * name;
  86. }
  87. mme_names [] =
  88. {
  89. {
  90. CC_CCO_APPOINT,
  91. &quot;CC_CCO_APPOINT&quot;
  92. },
  93. {
  94. CC_BACKUP_APPOINT,
  95. &quot;CC_BACKUP_APPOINT&quot;
  96. },
  97. {
  98. CC_LINK_INFO,
  99. &quot;CC_LINK_INFO&quot;
  100. },
  101. {
  102. CC_HANDOVER,
  103. &quot;CC_HANDOVER&quot;
  104. },
  105. {
  106. CC_HANDOVER_INFO,
  107. &quot;CC_HANDOVER_INFO&quot;
  108. },
  109. {
  110. CC_DISCOVER_LIST,
  111. &quot;CC_DISCOVER_LIST&quot;
  112. },
  113. {
  114. CC_LINK_NEW,
  115. &quot;CC_LINK_NEW&quot;
  116. },
  117. {
  118. CC_LINK_MOD,
  119. &quot;CC_LINK_MOD&quot;
  120. },
  121. {
  122. CC_LINK_SQZ,
  123. &quot;CC_LINK_SQZ&quot;
  124. },
  125. {
  126. CC_LINK_REL,
  127. &quot;CC_LINK_REL&quot;
  128. },
  129. {
  130. CC_DETECT_REPORT,
  131. &quot;CC_DETECT_REPORT&quot;
  132. },
  133. {
  134. CC_WHO_RU,
  135. &quot;CC_WHO_RU&quot;
  136. },
  137. {
  138. CC_ASSOC,
  139. &quot;CC_ASSOC&quot;
  140. },
  141. {
  142. CC_LEAVE,
  143. &quot;CC_LEAVE&quot;
  144. },
  145. {
  146. CC_SET_TEI_MAP,
  147. &quot;CC_SET_TEI_MAP&quot;
  148. },
  149. {
  150. CC_RELAY,
  151. &quot;CC_RELAY&quot;
  152. },
  153. {
  154. CC_BEACON_RELIABILITY,
  155. &quot;CC_BEACON_RELIABILITY&quot;
  156. },
  157. {
  158. CC_ALLOC_MOVE,
  159. &quot;CC_ALLOC_MOVE&quot;
  160. },
  161. {
  162. CC_ACCESS_NEW,
  163. &quot;CC_ACCESS_NEW&quot;
  164. },
  165. {
  166. CC_ACCESS_REL,
  167. &quot;CC_ACCESS_REL&quot;
  168. },
  169. {
  170. CC_DCPPC,
  171. &quot;CC_DCPPC&quot;
  172. },
  173. {
  174. CC_HP1_DET,
  175. &quot;CC_HP1_DET&quot;
  176. },
  177. {
  178. CC_BLE_UPDATE,
  179. &quot;CC_BLE_UPDATE&quot;
  180. },
  181. {
  182. CP_PROXY_APPOINT,
  183. &quot;CP_PROXY_APPOINT&quot;
  184. },
  185. {
  186. PH_PROXY_APPOINT,
  187. &quot;PH_PROXY_APPOINT&quot;
  188. },
  189. {
  190. CP_PROXY_WAKE,
  191. &quot;CP_PROXY_WAKE&quot;
  192. },
  193. {
  194. NN_INL,
  195. &quot;NN_INL&quot;
  196. },
  197. {
  198. NN_NEW_NET,
  199. &quot;NN_NEW_NET&quot;
  200. },
  201. {
  202. NN_ADD_ALLOC,
  203. &quot;NN_ADD_ALLOC&quot;
  204. },
  205. {
  206. NN_REL_ALLOC,
  207. &quot;NN_REL_ALLOC&quot;
  208. },
  209. {
  210. NN_REL_NET,
  211. &quot;NN_REL_NET&quot;
  212. },
  213. {
  214. CM_ASSOCIATED_STA,
  215. &quot;CM_ASSOCIATED_STA&quot;
  216. },
  217. {
  218. CM_ENCRYPTED_PAYLOAD,
  219. &quot;CM_ENCRYPTED_PAYLOAD&quot;
  220. },
  221. {
  222. CM_SET_KEY,
  223. &quot;CM_SET_KEY&quot;
  224. },
  225. {
  226. CM_GET_KEY,
  227. &quot;CM_GET_KEY&quot;
  228. },
  229. {
  230. CM_SC_JOIN,
  231. &quot;CM_SC_JOIN&quot;
  232. },
  233. {
  234. CM_CHAN_EST,
  235. &quot;CM_CHAN_EST&quot;
  236. },
  237. {
  238. CM_TM_UPDATE,
  239. &quot;CM_TM_UPDATE&quot;
  240. },
  241. {
  242. CM_AMP_MAP,
  243. &quot;CM_AMP_MAP&quot;
  244. },
  245. {
  246. CM_BRG_INFO,
  247. &quot;CM_BRG_INFO&quot;
  248. },
  249. {
  250. CM_CONN_NEW,
  251. &quot;CM_CONN_NEW&quot;
  252. },
  253. {
  254. CM_CONN_REL,
  255. &quot;CM_CONN_REL&quot;
  256. },
  257. {
  258. CM_CONN_MOD,
  259. &quot;CM_CONN_MOD&quot;
  260. },
  261. {
  262. CM_CONN_INFO,
  263. &quot;CM_CONN_INFO&quot;
  264. },
  265. {
  266. CM_STA_CAP,
  267. &quot;CM_STA_CAP&quot;
  268. },
  269. {
  270. CM_NW_INFO,
  271. &quot;CM_NW_INFO&quot;
  272. },
  273. {
  274. CM_GET_BEACON,
  275. &quot;CM_GET_BEACON&quot;
  276. },
  277. {
  278. CM_HFID,
  279. &quot;CM_HFID&quot;
  280. },
  281. {
  282. CM_MME_ERROR,
  283. &quot;CM_MME_ERROR&quot;
  284. },
  285. {
  286. CM_NW_STATS,
  287. &quot;CM_NW_STATS&quot;
  288. },
  289. {
  290. CM_SLAC_PARAM,
  291. &quot;CM_SLAC_PARAM&quot;
  292. },
  293. {
  294. CM_START_ATTEN_CHAR,
  295. &quot;CM_START_ATTEN_CHAR&quot;
  296. },
  297. {
  298. CM_ATTEN_CHAR,
  299. &quot;CM_ATTEN_CHAR&quot;
  300. },
  301. {
  302. CM_PKCS_CERT,
  303. &quot;CM_PKCS_CERT&quot;
  304. },
  305. {
  306. CM_MNBC_SOUND,
  307. &quot;CM_MNBC_SOUND&quot;
  308. },
  309. {
  310. CM_VALIDATE,
  311. &quot;CM_VALIDATE&quot;
  312. },
  313. {
  314. CM_SLAC_MATCH,
  315. &quot;CM_SLAC_MATCH&quot;
  316. },
  317. {
  318. CM_SLAC_USER_DATA,
  319. &quot;CM_SLAC_USER_DATA&quot;
  320. },
  321. {
  322. CM_ATTEN_PROFILE,
  323. &quot;CM_ATTEN_PROFILE&quot;
  324. },
  325. {
  326. MS_PB_ENC,
  327. &quot;MS_PB_ENC&quot;
  328. },
  329. {
  330. VS_SW_VER,
  331. &quot;VS_SW_VER&quot;
  332. },
  333. {
  334. VS_WR_MEM,
  335. &quot;VS_WR_MEM&quot;
  336. },
  337. {
  338. VS_RD_MEM,
  339. &quot;VS_RD_MEM&quot;
  340. },
  341. {
  342. VS_ST_MAC,
  343. &quot;VS_ST_MAC&quot;
  344. },
  345. {
  346. VS_GET_NVM,
  347. &quot;VS_GET_NVM&quot;
  348. },
  349. {
  350. 0xA028,
  351. &quot;RESERVED&quot;
  352. },
  353. {
  354. 0xA02C,
  355. &quot;RESERVED&quot;
  356. },
  357. {
  358. VS_RS_DEV,
  359. &quot;VS_RS_DEV&quot;
  360. },
  361. {
  362. VS_WR_MOD,
  363. &quot;VS_WR_MOD&quot;
  364. },
  365. {
  366. VS_RD_MOD,
  367. &quot;VS_RD_MOD&quot;
  368. },
  369. {
  370. VS_MOD_NVM,
  371. &quot;VS_MOD_NVM&quot;
  372. },
  373. {
  374. VS_WD_RPT,
  375. &quot;VS_WD_RPT&quot;
  376. },
  377. {
  378. VS_LNK_STATS,
  379. &quot;VS_LNK_STATS&quot;
  380. },
  381. {
  382. VS_SNIFFER,
  383. &quot;VS_SNIFFER&quot;
  384. },
  385. {
  386. VS_NW_INFO,
  387. &quot;VS_NW_INFO&quot;
  388. },
  389. {
  390. 0xA03C,
  391. &quot;RESERVED&quot;
  392. },
  393. {
  394. VS_CP_RPT,
  395. &quot;VS_CP_RPT&quot;
  396. },
  397. {
  398. VS_ARPC,
  399. &quot;VS_ARPC&quot;
  400. },
  401. {
  402. VS_SET_KEY,
  403. &quot;VS_SET_KEY&quot;
  404. },
  405. {
  406. VS_MFG_STRING,
  407. &quot;VS_MFG_STRING&quot;
  408. },
  409. {
  410. VS_RD_CBLOCK,
  411. &quot;VS_RD_CBLOCK&quot;
  412. },
  413. {
  414. VS_SET_SDRAM,
  415. &quot;VS_SET_SDRAM&quot;
  416. },
  417. {
  418. VS_HOST_ACTION,
  419. &quot;VS_HOST_ACTION&quot;
  420. },
  421. {
  422. VS_OP_ATTRIBUTES,
  423. &quot;VS_OP_ATTRIBUTES&quot;
  424. },
  425. {
  426. VS_ENET_SETTINGS,
  427. &quot;VS_ENET_SETTINGS&quot;
  428. },
  429. {
  430. VS_TONE_MAP_CHAR,
  431. &quot;VS_TONE_MAP_CHAR&quot;
  432. },
  433. {
  434. VS_NW_INFO_STATS,
  435. &quot;VS_NW_INFO_STATS&quot;
  436. },
  437. {
  438. VS_SLAVE_MEM,
  439. &quot;VS_SLAVE_MEM&quot;
  440. },
  441. {
  442. VS_FAC_DEFAULTS,
  443. &quot;VS_FAC_DEFAULTS&quot;
  444. },
  445. {
  446. VS_CLASSIFICATION,
  447. &quot;VS_CLASSIFICATION&quot;
  448. },
  449. {
  450. VS_RX_TONE_MAP_CHAR,
  451. &quot;VS_RX_TONE_MAP_CHAR&quot;
  452. },
  453. {
  454. VS_SET_LED_BEHAVIOR,
  455. &quot;VS_SET_LED_BEHAVIOR&quot;
  456. },
  457. {
  458. VS_WRITE_AND_EXECUTE_APPLET,
  459. &quot;VS_WRITE_AND_EXECUTE_APPLET&quot;
  460. },
  461. {
  462. VS_MDIO_COMMAND,
  463. &quot;VS_MDIO_COMMAND&quot;
  464. },
  465. {
  466. VS_SLAVE_REG,
  467. &quot;VS_SLAVE_REG&quot;
  468. },
  469. {
  470. VS_BANDWIDTH_LIMITING,
  471. &quot;VS_BANDWIDTH_LIMITING&quot;
  472. },
  473. {
  474. VS_SNID_OPERATION,
  475. &quot;VS_SNID_OPERATION&quot;
  476. },
  477. {
  478. VS_NN_MITIGATE,
  479. &quot;VS_NN_MITIGATE&quot;
  480. },
  481. {
  482. VS_MODULE_OPERATION,
  483. &quot;VS_MODULE_OPERATION&quot;
  484. },
  485. {
  486. VS_DIAG_NETWORK_PROBE,
  487. &quot;VS_DIAG_NETWORK_PROBE&quot;
  488. },
  489. {
  490. VS_PL_LINK_STATUS,
  491. &quot;VS_PL_LINK_STATUS&quot;
  492. },
  493. {
  494. VS_GPIO_STATE_CHANGE,
  495. &quot;VS_GPIO_STATE_CHANGE&quot;
  496. },
  497. {
  498. VS_CONN_ADD,
  499. &quot;VS_CONN_ADD&quot;
  500. },
  501. {
  502. VS_CONN_MOD,
  503. &quot;VS_CONN_MOD&quot;
  504. },
  505. {
  506. VS_CONN_REL,
  507. &quot;VS_CONN_REL&quot;
  508. },
  509. {
  510. VS_CONN_INFO,
  511. &quot;VS_CONN_INFO&quot;
  512. },
  513. {
  514. VS_MULTIPORT_LNK_STA,
  515. &quot;VS_MULTIPORT_LNK_STA&quot;
  516. },
  517. {
  518. VS_EM_ID_TABLE,
  519. &quot;VS_EM_ID_TABLE&quot;
  520. },
  521. {
  522. VS_STANDBY,
  523. &quot;VS_STANDBY&quot;
  524. },
  525. {
  526. VS_SLEEPSCHEDULE,
  527. &quot;VS_SLEEPSCHEDULE&quot;
  528. },
  529. {
  530. VS_SLEEPSCHEDULE_NOTIFICATION,
  531. &quot;VS_SLEEPSCHEDULE_NOTIFICATION&quot;
  532. },
  533. {
  534. 0xA0EC,
  535. &quot;RESERVED&quot;
  536. },
  537. {
  538. VS_MICROCONTROLLER_DIAG,
  539. &quot;VS_MICROCONTROLLER_DIAG&quot;
  540. },
  541. {
  542. VS_GET_PROPERTY,
  543. &quot;VS_GET_PROPERTY&quot;
  544. },
  545. {
  546. 0xA0FC,
  547. &quot;RESERVED&quot;
  548. },
  549. {
  550. VS_SET_PROPERTY,
  551. &quot;VS_SET_PROPERTY&quot;
  552. },
  553. {
  554. VS_PHYSWITCH_MDIO,
  555. &quot;VS_PHYSWITCH_MDIO&quot;
  556. },
  557. {
  558. VS_SELFTEST_ONETIME_CONFIG,
  559. &quot;VS_SELFTEST_ONETIME_CONFIG&quot;
  560. },
  561. {
  562. VS_SELFTEST_RESULTS,
  563. &quot;VS_SELFTEST_RESULTS&quot;
  564. },
  565. {
  566. VS_MDU_TRAFFIC_STATS,
  567. &quot;VS_MDU_TRAFFIC_STATS&quot;
  568. },
  569. {
  570. VS_FORWARD_CONFIG,
  571. &quot;VS_FORWARD_CONFIG&quot;
  572. },
  573. {
  574. 0xA11C,
  575. &quot;RESERVED&quot;
  576. },
  577. {
  578. VS_HYBRID_INFO,
  579. &quot;VS_HYBRID_INFO&quot;
  580. }
  581. };
  582. char const * MMEName (uint16_t MMTYPE)
  583. {
  584. size_t lower = 0;
  585. size_t upper = SIZEOF (mme_names);
  586. MMTYPE &amp;= MMTYPE_MASK;
  587. while (lower &lt; upper)
  588. {
  589. size_t index = (lower + upper) &gt;&gt; 1;
  590. signed order = MMTYPE - mme_names [index].type;
  591. if (order &lt; 0)
  592. {
  593. upper = index - 0;
  594. continue;
  595. }
  596. if (order &gt; 0)
  597. {
  598. lower = index + 1;
  599. continue;
  600. }
  601. return (mme_names [index].name);
  602. }
  603. return (&quot;UNKNOWN_MESSAGE_TYPE&quot;);
  604. }
  605. /*====================================================================*
  606. * print a multi-column list of MME codes and names on stdout;
  607. *--------------------------------------------------------------------*/
  608. #if 0
  609. #include &lt;stdio.h&gt;
  610. #define COLS 4
  611. #define WIDTH 20
  612. int main (int argc, char const * argv [])
  613. {
  614. unsigned cols = COLS;
  615. unsigned rows = ((SIZEOF (mme_names) + (COLS - 1)) / cols);
  616. unsigned row = 0;
  617. unsigned mme = 0;
  618. for (row = 0; row &lt; rows; row++)
  619. {
  620. for (mme = row; mme &lt; SIZEOF (mme_names); mme += rows)
  621. {
  622. printf (&quot;%04X %-*.*s &quot;, mme_names [mme].type, WIDTH, WIDTH, mme_names [mme].name);
  623. }
  624. printf (&quot;\n&quot;);
  625. }
  626. return (0);
  627. }
  628. #endif
  629. /*====================================================================*
  630. * print a multi-column list of MME codes and names on stdout;
  631. *--------------------------------------------------------------------*/
  632. #if 0
  633. #include &lt;stdio.h&gt;
  634. int main (int argc, char const * argv [])
  635. {
  636. unsigned mme = 0;
  637. for (mme = 0; mme &lt; SIZEOF (mme_names); mme++)
  638. {
  639. printf (&quot;{ %s, \&quot;%s\&quot; },&quot;, mme_names [mme].name, mme_names [mme].name);
  640. // printf (&quot;0x%04X;%s;yes;yes;yes\n&quot;, mme_names [mme].type, mme_names [mme].name);
  641. }
  642. return (0);
  643. }
  644. #endif
  645. /*====================================================================*
  646. *
  647. *--------------------------------------------------------------------*/
  648. #endif
  649. </pre>
  650. <div class='footerlink'>
  651. [<a href='MMEMode.c.html' title=' MMEMode.c '>PREV</a>]
  652. [<a href='toolkit.html' title=' Index '>HOME</a>]
  653. [<a href='MMEPeek.c.html' title=' MMEPeek.c '>NEXT</a>]
  654. </div>
  655. </body>
  656. </html>