slac.h.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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. slac.h
  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='sizes.h.html' title=' sizes.h '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='sll.h.html' title=' sll.h '>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. * slac.h -
  64. *
  65. * this file contains defintions for the HomePlug Green PHY SLAC
  66. * protocol;
  67. *
  68. *--------------------------------------------------------------------*/
  69. #ifndef SLAC_HEADER
  70. #define SLAC_HEADER
  71. /*====================================================================*
  72. * system header files;
  73. *--------------------------------------------------------------------*/
  74. #include &lt;stdint.h&gt;
  75. /*====================================================================*
  76. * custom header files;
  77. *--------------------------------------------------------------------*/
  78. #include &quot;../tools/types.h&quot;
  79. #include &quot;../tools/endian.h&quot;
  80. #include &quot;../ether/ether.h&quot;
  81. #include &quot;../mme/mme.h&quot;
  82. /*====================================================================*
  83. * constants;
  84. *--------------------------------------------------------------------*/
  85. #define SLAC_DEBUG 1
  86. /*
  87. * The following two constants control whether or not the PEV or EVSE
  88. * change AVLN on SLAC protocol cycle; The recommended setting is PEV
  89. * changes with each pass and the EVSE does not;
  90. */
  91. #define SLAC_AVLN_PEV 1
  92. #define SLAC_AVLN_EVSE 0
  93. #define SLAC_APPLICATION_PEV_EVSE 0x00
  94. #define SLAC_SECURITY_NONE 0x00
  95. #define SLAC_SECURITY_PUBLIC_KEY 0x01
  96. #define SLAC_RUNID_LEN 8
  97. #define SLAC_UNIQUE_ID_LEN 17
  98. #define SLAC_RND_LEN 16
  99. #define SLAC_NID_LEN 7
  100. #define SLAC_NMK_LEN 16
  101. #define SLAC_MSOUNDS 8
  102. #define SLAC_TIMETOSOUND 8
  103. #define SLAC_TIMEOUT 1000
  104. #define SLAC_APPLICATION_TYPE 0
  105. #define SLAC_SECURITY_TYPE 0
  106. #define SLAC_RESPONSE_TYPE 0
  107. #define SLAC_MSOUND_TARGET &quot;FF:FF:FF:FF:FF:FF&quot;
  108. #define SLAC_FORWARD_STATION &quot;00:00:00:00:00:00&quot;
  109. #define SLAC_GROUPS 58
  110. #define SLAC_LIMIT 40
  111. #define SLAC_PAUSE 20
  112. #define SLAC_SETTLETIME 10
  113. #define SLAC_CHARGETIME 2
  114. #define SLAC_FLAGS 0
  115. #define SLAC_SILENCE (1 &lt;&lt; 0)
  116. #define SLAC_VERBOSE (1 &lt;&lt; 1)
  117. #define SLAC_SESSION (1 &lt;&lt; 2)
  118. #define SLAC_COMPARE (1 &lt;&lt; 3)
  119. #define SLAC_CM_SETKEY_KEYTYPE 0x01
  120. #define SLAC_CM_SETKEY_PID 0x02
  121. #define SLAC_CM_SETKEY_PRN 0x00
  122. #define SLAC_CM_SETKEY_PMN 0x00
  123. #define SLAC_CM_SETKEY_CCO 0x00
  124. #define SLAC_CM_SETKEY_EKS 0x01
  125. /*====================================================================*
  126. * messages;
  127. *--------------------------------------------------------------------*/
  128. #ifndef __GNUC__
  129. #pragma pack (push,1)
  130. #endif
  131. typedef struct __packed session
  132. {
  133. struct session * next;
  134. struct session * prev;
  135. byte RunID [SLAC_RUNID_LEN];
  136. byte APPLICATION_TYPE;
  137. byte SECURITY_TYPE;
  138. byte RESP_TYPE;
  139. byte NUM_SOUNDS;
  140. byte TIME_OUT;
  141. byte AAG [SLAC_GROUPS];
  142. byte NumGroups;
  143. byte MSOUND_TARGET [ETHER_ADDR_LEN];
  144. byte FORWARDING_STA [ETHER_ADDR_LEN];
  145. byte PEV_ID [SLAC_UNIQUE_ID_LEN];
  146. byte PEV_MAC [ETHER_ADDR_LEN];
  147. byte EVSE_ID [SLAC_UNIQUE_ID_LEN];
  148. byte EVSE_MAC [ETHER_ADDR_LEN];
  149. byte RND [SLAC_UNIQUE_ID_LEN];
  150. byte NMK [SLAC_NMK_LEN];
  151. byte NID [SLAC_NID_LEN];
  152. byte original_nmk [SLAC_NMK_LEN];
  153. byte original_nid [SLAC_NID_LEN];
  154. unsigned state;
  155. unsigned sounds;
  156. unsigned limit;
  157. unsigned pause;
  158. unsigned chargetime;
  159. unsigned settletime;
  160. unsigned counter;
  161. unsigned flags;
  162. signed exit;
  163. }
  164. session;
  165. typedef struct __packed cm_sta_identity_request
  166. {
  167. struct ethernet_hdr ethernet;
  168. struct homeplug_fmi homeplug;
  169. }
  170. cm_sta_identity_request;
  171. typedef struct __packed cm_sta_identity_confirm
  172. {
  173. struct ethernet_hdr ethernet;
  174. struct homeplug_fmi homeplug;
  175. uint8_t GREEN_PHY_CAPABILITY;
  176. uint8_t POWER_SAVE_CAPABILITY;
  177. uint8_t GREEN_PHY_PREFERRED_ALLOCATION_CAPABILITY;
  178. uint8_t REPEATING_AND_ROUTING_CAPABILITY;
  179. uint8_t HOMEPLUG_AV_VERSION;
  180. uint8_t EFL;
  181. uint8_t EF [1];
  182. }
  183. cm_sta_identity_confirm;
  184. typedef struct __packed cm_slac_param_request
  185. {
  186. struct ethernet_hdr ethernet;
  187. struct homeplug_fmi homeplug;
  188. uint8_t APPLICATION_TYPE;
  189. uint8_t SECURITY_TYPE;
  190. uint8_t RunID [SLAC_RUNID_LEN];
  191. uint8_t CipherSuiteSetSize;
  192. uint16_t CipherSuite [1];
  193. }
  194. cm_slac_param_request;
  195. typedef struct __packed cm_slac_param_confirm
  196. {
  197. struct ethernet_hdr ethernet;
  198. struct homeplug_fmi homeplug;
  199. uint8_t MSOUND_TARGET [ETHER_ADDR_LEN];
  200. uint8_t NUM_SOUNDS;
  201. uint8_t TIME_OUT;
  202. uint8_t RESP_TYPE;
  203. uint8_t FORWARDING_STA [ETHER_ADDR_LEN];
  204. uint8_t APPLICATION_TYPE;
  205. uint8_t SECURITY_TYPE;
  206. uint8_t RunID [SLAC_RUNID_LEN];
  207. uint16_t CipherSuite;
  208. }
  209. cm_slac_param_confirm;
  210. typedef struct __packed cm_start_atten_char_indicate
  211. {
  212. struct ethernet_hdr ethernet;
  213. struct homeplug_fmi homeplug;
  214. uint8_t APPLICATION_TYPE;
  215. uint8_t SECURITY_TYPE;
  216. struct __packed
  217. {
  218. uint8_t NUM_SOUNDS;
  219. uint8_t TIME_OUT;
  220. uint8_t RESP_TYPE;
  221. uint8_t FORWARDING_STA [ETHER_ADDR_LEN];
  222. uint8_t RunID [SLAC_RUNID_LEN];
  223. }
  224. ACVarField;
  225. }
  226. cm_start_atten_char_indicate;
  227. typedef struct __packed cm_start_atten_char_response
  228. {
  229. struct ethernet_hdr ethernet;
  230. struct homeplug_fmi homeplug;
  231. }
  232. cm_start_atten_char_response;
  233. typedef struct __packed cm_atten_char_indicate
  234. {
  235. struct ethernet_hdr ethernet;
  236. struct homeplug_fmi homeplug;
  237. uint8_t APPLICATION_TYPE;
  238. uint8_t SECURITY_TYPE;
  239. struct __packed
  240. {
  241. uint8_t SOURCE_ADDRESS [ETHER_ADDR_LEN];
  242. uint8_t RunID [SLAC_RUNID_LEN];
  243. uint8_t SOURCE_ID [SLAC_UNIQUE_ID_LEN];
  244. uint8_t RESP_ID [SLAC_UNIQUE_ID_LEN];
  245. uint8_t NUM_SOUNDS;
  246. struct __packed
  247. {
  248. uint8_t NumGroups;
  249. uint8_t AAG [255];
  250. }
  251. ATTEN_PROFILE;
  252. }
  253. ACVarField;
  254. }
  255. cm_atten_char_indicate;
  256. typedef struct __packed cm_atten_char_response
  257. {
  258. struct ethernet_hdr ethernet;
  259. struct homeplug_fmi homeplug;
  260. uint8_t APPLICATION_TYPE;
  261. uint8_t SECURITY_TYPE;
  262. struct __packed
  263. {
  264. uint8_t SOURCE_ADDRESS [ETHER_ADDR_LEN];
  265. uint8_t RunID [SLAC_RUNID_LEN];
  266. uint8_t SOURCE_ID [SLAC_UNIQUE_ID_LEN];
  267. uint8_t RESP_ID [SLAC_UNIQUE_ID_LEN];
  268. uint8_t Result;
  269. }
  270. ACVarField;
  271. }
  272. cm_atten_char_response;
  273. typedef struct __packed cm_mnbc_sound_indicate
  274. {
  275. struct ethernet_hdr ethernet;
  276. struct homeplug_fmi homeplug;
  277. uint8_t APPLICATION_TYPE;
  278. uint8_t SECURITY_TYPE;
  279. struct __packed
  280. {
  281. uint8_t SenderID [SLAC_UNIQUE_ID_LEN];
  282. uint8_t CNT;
  283. uint8_t RunID [SLAC_RUNID_LEN];
  284. uint8_t RND [SLAC_UNIQUE_ID_LEN];
  285. }
  286. MSVarField;
  287. }
  288. cm_mnbc_sound_indcate;
  289. typedef struct __packed cm_validate_request
  290. {
  291. struct ethernet_hdr ethernet;
  292. struct homeplug_fmi homeplug;
  293. uint8_t SignalType;
  294. struct __packed
  295. {
  296. uint8_t Timer;
  297. uint8_t Result;
  298. }
  299. VRVarField;
  300. }
  301. cm_validate_request;
  302. typedef struct __packed cm_validate_confirm
  303. {
  304. struct ethernet_hdr ethernet;
  305. struct homeplug_fmi homeplug;
  306. uint8_t SignalType;
  307. struct __packed
  308. {
  309. uint8_t ToggleNum;
  310. uint8_t Result;
  311. }
  312. VCVarField;
  313. }
  314. cm_validate_confirm;
  315. typedef struct __packed cm_slac_match_request
  316. {
  317. struct ethernet_hdr ethernet;
  318. struct homeplug_fmi homeplug;
  319. uint8_t APPLICATION_TYPE;
  320. uint8_t SECURITY_TYPE;
  321. uint16_t MVFLength;
  322. struct __packed
  323. {
  324. uint8_t PEV_ID [SLAC_UNIQUE_ID_LEN];
  325. uint8_t PEV_MAC [ETHER_ADDR_LEN];
  326. uint8_t EVSE_ID [SLAC_UNIQUE_ID_LEN];
  327. uint8_t EVSE_MAC [ETHER_ADDR_LEN];
  328. uint8_t RunID [SLAC_RUNID_LEN];
  329. uint8_t RSVD [8];
  330. }
  331. MatchVarField;
  332. }
  333. cm_slac_match_request;
  334. typedef struct __packed cm_slac_match_confirm
  335. {
  336. struct ethernet_hdr ethernet;
  337. struct homeplug_fmi homeplug;
  338. uint8_t APPLICATION_TYPE;
  339. uint8_t SECURITY_TYPE;
  340. uint16_t MVFLength;
  341. struct __packed
  342. {
  343. uint8_t PEV_ID [SLAC_UNIQUE_ID_LEN];
  344. uint8_t PEV_MAC [ETHER_ADDR_LEN];
  345. uint8_t EVSE_ID [SLAC_UNIQUE_ID_LEN];
  346. uint8_t EVSE_MAC [ETHER_ADDR_LEN];
  347. uint8_t RunID [SLAC_RUNID_LEN];
  348. uint8_t RSVD1 [8];
  349. uint8_t NID [SLAC_NID_LEN];
  350. uint8_t RSVD2;
  351. uint8_t NMK [SLAC_NMK_LEN];
  352. }
  353. MatchVarField;
  354. }
  355. cm_slac_match_confirm;
  356. typedef struct __packed cm_atten_profile_indicate
  357. {
  358. struct ethernet_hdr ethernet;
  359. struct homeplug_fmi homeplug;
  360. uint8_t PEV_MAC [ETHER_ADDR_LEN];
  361. uint8_t NumGroups;
  362. uint8_t RSVD;
  363. uint8_t AAG [255];
  364. }
  365. cm_atten_profile_indicate;
  366. #ifndef __GNUC__
  367. #pragma pack (pop)
  368. #endif
  369. /*====================================================================*
  370. * functions;
  371. *--------------------------------------------------------------------*/
  372. signed pev_cm_slac_param (struct session *, struct channel *, struct message *);
  373. signed pev_cm_start_atten_char (struct session *, struct channel *, struct message *);
  374. signed pev_cm_atten_char (struct session *, struct channel *, struct message *);
  375. signed pev_cm_mnbc_sound (struct session *, struct channel *, struct message *);
  376. signed pev_cm_slac_match (struct session *, struct channel *, struct message *);
  377. signed pev_cm_set_key (struct session *, struct channel *, struct message *);
  378. signed evse_cm_slac_param (struct session *, struct channel *, struct message *);
  379. signed evse_cm_start_atten_char (struct session *, struct channel *, struct message *);
  380. signed evse_cm_atten_char (struct session *, struct channel *, struct message *);
  381. signed evse_cm_mnbc_sound (struct session *, struct channel *, struct message *);
  382. signed evse_cm_slac_match (struct session *, struct channel *, struct message *);
  383. signed evse_cm_set_key (struct session *, struct channel *, struct message *);
  384. signed slac_connect (struct session *);
  385. void slac_session (struct session *);
  386. void slac_structs ();
  387. signed slac_debug (struct session * session, signed status, char const * string, char const * format, ...);
  388. /*====================================================================*
  389. *
  390. *--------------------------------------------------------------------*/
  391. #endif
  392. </pre>
  393. <div class='footerlink'>
  394. [<a href='sizes.h.html' title=' sizes.h '>PREV</a>]
  395. [<a href='toolkit.html' title=' Index '>HOME</a>]
  396. [<a href='sll.h.html' title=' sll.h '>NEXT</a>]
  397. </div>
  398. </body>
  399. </html>