wm_wifi.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162
  1. /**
  2. * @file wm_wifi.h
  3. *
  4. * @brief Wi-Fi API
  5. *
  6. * @author WinnerMicro
  7. *
  8. * Copyright (c) 2015 Winner Microelectronics Co., Ltd.
  9. */
  10. #ifndef TLS_WIFI_FUNC_H
  11. #define TLS_WIFI_FUNC_H
  12. /* Return Error definition*/
  13. /** invalid SSID */
  14. #define WM_WIFI_ERR_SSID -1
  15. /** invalid key */
  16. #define WM_WIFI_ERR_KEY -2
  17. /** wps is busing */
  18. #define WM_WIFI_WPS_BUSY -3
  19. /** scan is busing */
  20. #define WM_WIFI_SCANNING_BUSY -4
  21. /** station is connecting */
  22. #define WM_WIFI_STA_BUSY -5
  23. /* error number definition */
  24. /** no error */
  25. #define WM_WIFI_ENOERR 0
  26. /** ap not exist */
  27. #define WM_WIFI_ENOAP 1
  28. /** pre-shared key may be incorrect */
  29. #define WM_WIFI_EKEY 2
  30. /** Low signal intensity */
  31. #define WM_WIFI_ELSI 3
  32. #ifndef ETH_ALEN
  33. /** mac address length */
  34. #define ETH_ALEN 6
  35. #endif
  36. /* bss type definition*/
  37. #ifndef IEEE80211_MODE_INFRA
  38. /** station mode */
  39. #define IEEE80211_MODE_INFRA 1
  40. /** ibss mode */
  41. #define IEEE80211_MODE_IBSS 2
  42. /** softap mode */
  43. #define IEEE80211_MODE_AP 4
  44. #endif
  45. /** authenticate mode : open */
  46. #define IEEE80211_ENCRYT_NONE 0
  47. /** authenticate mode : WEP40 */
  48. #define IEEE80211_ENCRYT_WEP40 1
  49. /** authenticate mode : WEP104 */
  50. #define IEEE80211_ENCRYT_WEP104 2
  51. /** authenticate mode : WPA_PSK_TKIP */
  52. #define IEEE80211_ENCRYT_TKIP_WPA 3
  53. /** authenticate mode : WPA_PSK_CCMP */
  54. #define IEEE80211_ENCRYT_CCMP_WPA 4
  55. /** authenticate mode : WPA2_PSK_TKIP */
  56. #define IEEE80211_ENCRYT_TKIP_WPA2 5
  57. /** authenticate mode : WPA2_PSK_CCMP */
  58. #define IEEE80211_ENCRYT_CCMP_WPA2 6
  59. /** authenticate mode : WPA_PSK_TKIP&AES */
  60. #define IEEE80211_ENCRYT_AUTO_WPA 7
  61. /** authenticate mode : WPA2_PSK_TKIP&AES */
  62. #define IEEE80211_ENCRYT_AUTO_WPA2 8
  63. #ifdef TLS_CONFIG_WPS
  64. /** length of WPS pin code */
  65. #define WPS_PIN_LEN 8
  66. #endif
  67. /** set auto connecting flag */
  68. #define WIFI_AUTO_CNT_FLAG_SET 1
  69. /** get auto connecting flag */
  70. #define WIFI_AUTO_CNT_FLAG_GET 0
  71. /** disable Wi-Fi auto connecting */
  72. #define WIFI_AUTO_CNT_OFF 0x0
  73. /** enable Wi-Fi auto connecting */
  74. #define WIFI_AUTO_CNT_ON 0x1
  75. /** disable Wi-Fi auto connecting temporary */
  76. #define WIFI_AUTO_CNT_TMP_OFF 0x3
  77. /** Wi-Fi join net successfully */
  78. #define WIFI_JOIN_SUCCESS 0x1
  79. /** Wi-Fi join net failed */
  80. #define WIFI_JOIN_FAILED 0x2
  81. /** Wi-Fi disconnected */
  82. #define WIFI_DISCONNECTED 0x3
  83. /** Wi-Fi create ap successfully */
  84. #define WIFI_SOFTAP_SUCCESS 0x4
  85. /** Wi-Fi create softap failure */
  86. #define WIFI_SOFTAP_FAILED 0x5
  87. /** Wi-Fi close softap */
  88. #define WIFI_SOFTAP_CLOSED 0x6
  89. enum tls_wifi_auth_mode {
  90. WM_WIFI_AUTH_MODE_OPEN = 0, /**< authenticate mode : open */
  91. WM_WIFI_AUTH_MODE_WEP_AUTO = 3, /**< authenticate mode : wep (open or/and shared...) */
  92. WM_WIFI_AUTH_MODE_WPA_PSK_TKIP = 4, /**< authenticate mode : wpa psk rc4 */
  93. WM_WIFI_AUTH_MODE_WPA_PSK_CCMP = 8, /**< authenticate mode : wpa psk aes */
  94. WM_WIFI_AUTH_MODE_WPA_PSK_AUTO = (WM_WIFI_AUTH_MODE_WPA_PSK_TKIP | WM_WIFI_AUTH_MODE_WPA_PSK_CCMP), /**< authenticate mode : wpa psk, tkip and aes */
  95. WM_WIFI_AUTH_MODE_WPA2_PSK_TKIP = 16, /**< authenticate mode : wpa2 psk rc4 */
  96. WM_WIFI_AUTH_MODE_WPA2_PSK_CCMP = 32, /**< authenticate mode : wpa2 psk aes */
  97. WM_WIFI_AUTH_MODE_WPA2_PSK_AUTO = (WM_WIFI_AUTH_MODE_WPA2_PSK_TKIP | WM_WIFI_AUTH_MODE_WPA2_PSK_CCMP), /**< authenticate mode : wpa2 psk, tkip and aes */
  98. WM_WIFI_AUTH_MODE_WPA_WPA2_PSK_TKIP = (WM_WIFI_AUTH_MODE_WPA_PSK_TKIP | WM_WIFI_AUTH_MODE_WPA2_PSK_TKIP),
  99. WM_WIFI_AUTH_MODE_WPA_WPA2_PSK_CCMP = (WM_WIFI_AUTH_MODE_WPA_PSK_CCMP | WM_WIFI_AUTH_MODE_WPA2_PSK_CCMP),
  100. WM_WIFI_AUTH_MODE_WPA_WPA2_PSK_AUTO = (WM_WIFI_AUTH_MODE_WPA_PSK_AUTO | WM_WIFI_AUTH_MODE_WPA2_PSK_AUTO), /**< authenticate mode : wpa and wpa2, tkip and aes */
  101. WM_WIFI_AUTH_MODE_UNKNOWN = 128
  102. };
  103. /** Wi-Fi states */
  104. enum tls_wifi_states {
  105. WM_WIFI_DISCONNECTED, /**< Disconnected state */
  106. WM_WIFI_SCANNING, /**< Scanning for a network */
  107. WM_WIFI_JOINING, /**< Trying to join with a BSS/SSID */
  108. WM_WIFI_JOINED /**< All authentication completed */
  109. };
  110. /** frame type of the manager */
  111. enum tls_wifi_mgmt_type {
  112. WM_WIFI_MGMT_TYPE_ASSOC_REQ = 0x0000, /**< association request frame */
  113. WM_WIFI_MGMT_TYPE_ASSOC_RESP = 0x0010, /**< association response frame */
  114. WM_WIFI_MGMT_TYPE_REASSOC_REQ = 0x0020, /**< reassociation request frame */
  115. WM_WIFI_MGMT_TYPE_REASSOC_RESP = 0x0030, /**< reassociation response frame */
  116. WM_WIFI_MGMT_TYPE_PROBE_REQ = 0x0040, /**< probe request frame */
  117. WM_WIFI_MGMT_TYPE_PROBE_RESP = 0x0050, /**< probe response frame */
  118. WM_WIFI_MGMT_TYPE_BEACON = 0x0080, /**< beacon frame */
  119. WM_WIFI_MGMT_TYPE_ATIM = 0x0090, /**< ATIM frame */
  120. WM_WIFI_MGMT_TYPE_DISASSOC = 0x00A0, /**< disassociation frame */
  121. WM_WIFI_MGMT_TYPE_AUTH = 0x00B0, /**< authentication frame */
  122. WM_WIFI_MGMT_TYPE_DEAUTH = 0x00C0, /**< deauthentication frame */
  123. WM_WIFI_MGMT_TYPE_ACTION = 0x00D0 /**< action frame */
  124. };
  125. /** Wi-Fi ransport rate */
  126. enum tls_wifi_tx_rate {
  127. WM_WIFI_TX_RATEIDX_1M = 0, /**< 11b, 1M */
  128. WM_WIFI_TX_RATEIDX_2M, /**< 11b, 2M */
  129. WM_WIFI_TX_RATEIDX_5_5M, /**< 11b, 5.5M */
  130. WM_WIFI_TX_RATEIDX_11M, /**< 11b, 11M */
  131. WM_WIFI_TX_RATEIDX_6M, /**< 11g, 6M */
  132. WM_WIFI_TX_RATEIDX_9M, /**< 11g, 9M */
  133. WM_WIFI_TX_RATEIDX_12M, /**< 11g, 12M */
  134. WM_WIFI_TX_RATEIDX_18M, /**< 11g, 18M */
  135. WM_WIFI_TX_RATEIDX_24M, /**< 11g, 24M */
  136. WM_WIFI_TX_RATEIDX_36M, /**< 11g, 36M */
  137. WM_WIFI_TX_RATEIDX_48M, /**< 11g, 48M */
  138. WM_WIFI_TX_RATEIDX_54M, /**< 11g, 54M */
  139. WM_WIFI_TX_RATEIDX_MCS0, /**< 11n-20MHz, mcs0 */
  140. WM_WIFI_TX_RATEIDX_MCS1, /**< 11n-20MHz, mcs1 */
  141. WM_WIFI_TX_RATEIDX_MCS2, /**< 11n-20MHz, mcs2 */
  142. WM_WIFI_TX_RATEIDX_MCS3, /**< 11n-20MHz, mcs3 */
  143. WM_WIFI_TX_RATEIDX_MCS4, /**< 11n-20MHz, mcs4 */
  144. WM_WIFI_TX_RATEIDX_MCS5, /**< 11n-20MHz, mcs5 */
  145. WM_WIFI_TX_RATEIDX_MCS6, /**< 11n-20MHz, mcs6 */
  146. WM_WIFI_TX_RATEIDX_MCS7, /**< 11n-20MHz, mcs7 */
  147. WM_WIFI_TX_RATEIDX_MCS8, /**< 11n-40MHz, mcs8 */
  148. WM_WIFI_TX_RATEIDX_MCS9, /**< 11n-40MHz, mcs9 */
  149. WM_WIFI_TX_RATEIDX_MCS10, /**< 11n-40MHz, mcs10 */
  150. WM_WIFI_TX_RATEIDX_MCS11, /**< 11n-40MHz, mcs11 */
  151. WM_WIFI_TX_RATEIDX_MCS12, /**< 11n-40MHz, mcs12 */
  152. WM_WIFI_TX_RATEIDX_MCS13, /**< 11n-40MHz, mcs13 */
  153. WM_WIFI_TX_RATEIDX_MCS14, /**< 11n-40MHz, mcs14 */
  154. WM_WIFI_TX_RATEIDX_MCS15, /**< 11n-40MHz, mcs15 */
  155. WM_WIFI_TX_RATEIDX_MCS32 /**< invalid rate */
  156. };
  157. enum tls_wifi_oneshot_result_type {
  158. WM_WIFI_ONESHOT_TYPE_SSIDPWD,
  159. WM_WIFI_ONESHOT_TYPE_CUSTOMDATA
  160. };
  161. enum tls_wifi_client_event_type {
  162. WM_WIFI_CLIENT_EVENT_ONLINE,
  163. WM_WIFI_CLIENT_EVENT_OFFLINE
  164. };
  165. enum tls_wifi_op_mode{
  166. STATION_MODE = 1,
  167. SOFTAP_MODE,
  168. STATIONAP_MODE
  169. };
  170. /** current bss information */
  171. struct tls_curr_bss_t{
  172. u8 bssid[ETH_ALEN]; /**< BSSID of connected AP */
  173. u8 ssid[32]; /**< SSID of connected AP */
  174. u8 ssid_len; /**< SSID length of connected AP */
  175. u8 channel; /**< channel of connected AP */
  176. u8 type; /**< BSS's type of connected AP, value is:
  177. IEEE80211_MODE_INFRA, IEEE80211_MODE_IBSS,
  178. IEEE80211_MODE_AP, IEEE80211_MODE_APSTA */
  179. u8 encryptype; /**< BSS's encryption type of connected AP, value is: IEEE80211_ENCRYT_NONE,
  180. IEEE80211_ENCRYT_WEP40, IEEE80211_ENCRYT_WEP104,
  181. IEEE80211_ENCRYT_TKIP_WPA, IEEE80211_ENCRYT_CCMP_WPA,
  182. IEEE80211_ENCRYT_TKIP_WPA2, IEEE80211_ENCRYT_CCMP_WPA2,
  183. IEEE80211_ENCRYT_AUTO_WPA, IEEE80211_ENCRYT_AUTO_WPA2 */
  184. u8 rssi; /**< single strength of AP */
  185. };
  186. /** secret key information */
  187. struct tls_key_info_t{
  188. u8 format; /**< key format, value is: 0-hex, 1-ascii */
  189. u8 index; /**< key index, value is: 1-4 (only wep) */
  190. u8 key_len; /**< key length */
  191. u8 key[64]; /**< key content */
  192. };
  193. /** Wi-Fi configuration of softap */
  194. struct tls_softap_info_t{
  195. u8 ssid[33]; /**< SSID of softap */
  196. u8 encrypt; /**< encryption mode of softap, value is: IEEE80211_ENCRYT_NONE,
  197. IEEE80211_ENCRYT_WEP40, IEEE80211_ENCRYT_WEP104,
  198. IEEE80211_ENCRYT_TKIP_WPA, IEEE80211_ENCRYT_CCMP_WPA,
  199. IEEE80211_ENCRYT_TKIP_WPA2, IEEE80211_ENCRYT_CCMP_WPA2 */
  200. u8 channel; /**< channel of softap */
  201. struct tls_key_info_t keyinfo; /**< Password (key) of softap */
  202. };
  203. /** ip address information */
  204. struct tls_ip_info_t{
  205. u8 ip_addr[4]; /**< IP address */
  206. u8 netmask[4]; /**< netmask */
  207. u8 dnsname[32]; /**< DNS server name */
  208. };
  209. /** Wi-Fi configuration of ibss */
  210. struct tls_ibss_info_t{
  211. u8 ssid[33]; /**< SSID of ibss */
  212. u8 encrypt; /**< encryption mode of ibss, value is: IEEE80211_ENCRYT_NONE,
  213. IEEE80211_ENCRYT_WEP40, IEEE80211_ENCRYT_WEP104,
  214. IEEE80211_ENCRYT_TKIP_WPA, IEEE80211_ENCRYT_CCMP_WPA,
  215. IEEE80211_ENCRYT_TKIP_WPA2, IEEE80211_ENCRYT_CCMP_WPA2,
  216. IEEE80211_ENCRYT_AUTO_WPA, IEEE80211_ENCRYT_AUTO_WPA2 */
  217. u8 channel; /**< channel of ibss */
  218. struct tls_key_info_t keyinfo; /**< Password (key) of ibss */
  219. };
  220. /** ip address information of ibss */
  221. struct tls_ibssip_info_t{
  222. u8 ip[4]; /**< IP address */
  223. u8 netmask[4]; /**< netmask */
  224. u8 gateway[4]; /**< gateway */
  225. u8 dns1[4]; /**< DNS1 IP address */
  226. u8 dns2[4]; /**< DNS2 IP address */
  227. };
  228. /** bss information */
  229. struct tls_bss_info_t {
  230. u8 bssid[ETH_ALEN]; /**< MAC address of AP */
  231. u8 mode; /**< AP type, value is: 1-ibss, 2-ess */
  232. u8 channel; /**< channel of AP */
  233. u8 privacy; /**< encryption type, @ref enum tls_wifi_auth_mode */
  234. u8 ssid_len; /**< SSID length */
  235. u8 rssi; /**< signal strength of AP, real rssi = (signed char)rssi */
  236. u8 ssid[32]; /**< SSID of AP */
  237. u32 max_data_rate; /**< maximum rate of AP, the unit is Mbps */
  238. bool wps_support; /**< is support WPS function */
  239. };
  240. /** scan result */
  241. struct tls_scan_bss_t {
  242. u32 count; /**< total count */
  243. u32 length; /**< bss info total length */
  244. struct tls_bss_info_t bss[1]; /**< list of bss found*/
  245. };
  246. /** station information */
  247. struct tls_sta_info_t {
  248. u8 mac_addr[ETH_ALEN]; /**< MAC address of station */
  249. };
  250. /** 802.11 packet information from the physical layer */
  251. struct tls_wifi_ext_t {
  252. u8 rssi; /**< signal strength */
  253. u8 rx_rate; /**< Rx_rate */
  254. };
  255. /** 802.11 mac address */
  256. struct tls_wifi_hdr_mac_t {
  257. u8 da_addr[ETH_ALEN]; /**< MAC address of destination */
  258. u8 sa_addr[ETH_ALEN]; /**< MAC address of source */
  259. u8 bssid[ETH_ALEN]; /**< MAC address of AP */
  260. };
  261. /** transport rate and gain */
  262. struct tls_wifi_tx_rate_t {
  263. enum tls_wifi_tx_rate tx_rate; /**< Wi-Fi ransport rate */
  264. u8 tx_gain; /**< Wi-Fi ransport gain,
  265. The caller can get the maximum gain
  266. by using the tls_wifi_get_tx_gain_max function. */
  267. u8 retry_times; /**< Wi-Fi number of retransmissions, ranging from 1 to 15. */
  268. };
  269. /** scan param */
  270. struct tls_wifi_scan_param_t{
  271. u32 scan_times; /**< Scan times, >=0, if zero, only 1 times */
  272. u16 scan_chanlist; /**< Scan channel list ,[0,3FFF],per bit is one channel,if zero or above 0x3FFF, scan all channel*/
  273. u16 scan_chinterval; /**< Scan channel switch time,>=0, if zero, use default value, unit:ms */
  274. };
  275. /** callback function of receive Wi-Fi data */
  276. typedef void (*tls_wifi_data_recv_callback)(u8* data, u32 data_len);
  277. /** callback function of Wi-Fi PSMode Preprocess when enter chipsleep function */
  278. typedef void (*tls_wifi_psm_prechipsleep_callback)(void);
  279. /** callback function of Wi-Fi PSMode Using chipsleep function */
  280. typedef void (*tls_wifi_psm_chipsleep_callback)(u32 sleeptime);
  281. /** callback function of Wi-Fi PSMode Postprocess after chip wakeup */
  282. typedef void (*tls_wifi_psm_postchipsleep_callback)(void);
  283. /** callback function of receive ETHERNET data */
  284. typedef int (*net_rx_data_cb)(const u8 *bssid, u8 *buf, u32 buf_len);
  285. /** callback function of receive Wi-Fi data with some information of the physical layer */
  286. typedef void (*tls_wifi_data_ext_recv_callback)(u8* data, u32 data_len, struct tls_wifi_ext_t *ext);
  287. /**
  288. * @defgroup Wi-Fi_APIs Wi-Fi APIs
  289. * @brief Wi-Fi related APIs
  290. */
  291. /**
  292. * @addtogroup Wi-Fi_APIs
  293. * @{
  294. */
  295. /**
  296. * @brief This function is used to enable/disable listen mode
  297. *
  298. * @param[in] enable:non-zero, disable: 0
  299. *
  300. * @return None
  301. *
  302. * @note This function used when oneshot start.
  303. */
  304. void tls_wifi_set_listen_mode(u8 enable);
  305. /**
  306. * @brief This function is used to get listen mode
  307. *
  308. * @param None
  309. *
  310. * @retval 0 normal mode
  311. * @retval non-zero listen mode
  312. *
  313. * @note None
  314. */
  315. u8 tls_wifi_get_listen_mode(void);
  316. /**
  317. * @brief This function is used to filter multicast frames
  318. * @param mac: The multicast frame that we want receive or filter.
  319. *
  320. * @param receive: 1, receive this multicast frame
  321. * 0, filter this multicast frame
  322. *
  323. * @note usage: For example: u8 mac[6]={01, 00, 5e, 7f, ff, fa},if receive
  324. * is set to 0,the 802.11 multicast frames whose hdr->addr1 is
  325. * [01 00 5e 7f ff fa] will be filtered.
  326. */
  327. u8 tls_filter_mcast_mac(u8 *mac, u8 receive);
  328. /**
  329. * @brief This function is used to set mac filter.
  330. * @param[in] mac: mac: to be filtered or received
  331. *
  332. * @param[in] receive: 1:not filter,zero:filter
  333. *
  334. * @param[in] clear: 1:clear all, 0:do not clear, only add new filter
  335. *
  336. * @return None
  337. *
  338. * @note usage: normally, it is used to oneshot config
  339. */
  340. void tls_wifi_set_bcast_mac_filter(u8 *mac, u8 receive, u8 clear);
  341. /**
  342. * @brief This function is used to restore mac filter to normal mode.
  343. *
  344. * @param[in] None
  345. *
  346. * @return None
  347. *
  348. * @note Normally, it is used to restore mac filter after oneshot config
  349. */
  350. void tls_wifi_restore_bcast_mac_filter(void);
  351. /**
  352. * @brief This function is used to register recv wifi data callback function
  353. *
  354. * @param[in] callback point to receive Wi-Fi data function
  355. *
  356. * @return None
  357. *
  358. * @note None
  359. */
  360. void tls_wifi_data_recv_cb_register(tls_wifi_data_recv_callback callback);
  361. /**
  362. * @brief This function is used to register recv wifi extended
  363. * data callback function
  364. *
  365. * @param[in] callback point to receive Wi-Fi extended data function
  366. *
  367. * @return None
  368. *
  369. * @note None
  370. */
  371. void tls_wifi_data_ext_recv_cb_register(tls_wifi_data_ext_recv_callback callback);
  372. /**
  373. * @brief This function is used to register recv wifi management frame
  374. * callback function
  375. *
  376. * @param[in] callback point to receive Wi-Fi management frame function
  377. *
  378. * @return None
  379. *
  380. * @note None
  381. */
  382. void tls_wifi_mgmt_ext_recv_cb_register(tls_wifi_data_ext_recv_callback callback);
  383. /**
  384. * @brief This function is used to register chipsleep callback function
  385. * when using chip sleep for powersaving
  386. *
  387. * @param[in] sleepcallback: pointer to function when enter to chipsleep
  388. * @param[in] precallback: pointer to function before enter to chipsleep
  389. * @param[in] postcallback: pointer to function after leave chipsleep
  390. *
  391. * @return None
  392. *
  393. * @note None
  394. */
  395. void tls_wifi_psm_chipsleep_cb_register(tls_wifi_psm_chipsleep_callback sleepcallback,
  396. tls_wifi_psm_prechipsleep_callback precallback,
  397. tls_wifi_psm_postchipsleep_callback postcallback);
  398. /**
  399. * @brief This function is used to set chipsleep valid flag
  400. *
  401. * @param[in] flag: use chipsleep when psm using.0:using normal wifi sleep, non-zero:using chipsleep
  402. *
  403. * @return None
  404. *
  405. * @note None
  406. */
  407. void tls_wifi_set_psm_chipsleep_flag(u32 flag);
  408. /**
  409. * @brief This function is used to get chipsleep valid flag
  410. *
  411. * @param[in] None
  412. *
  413. * @return None
  414. *
  415. * @note None
  416. */
  417. u32 tls_wifi_get_psm_chipsleep_flag(void);
  418. /**
  419. * @brief This function is used to set oneshot config flag
  420. *
  421. * @param[in] flag 0: closed oneshot
  422. * 1: one shot open
  423. * 2: AP+socket
  424. * 3: AP+WEBSERVER
  425. * 4: bt
  426. *
  427. * @return 0£ºsuccess
  428. * -1£ºfailed
  429. *
  430. * @note None
  431. */
  432. int tls_wifi_set_oneshot_flag(u8 flag);
  433. /**
  434. * @brief This function is used to get one shot flag
  435. *
  436. * @param None
  437. *
  438. * @retval 0: oneshot closed
  439. * 1: one shot open
  440. * 2: AP+socket
  441. * 3: AP+WEBSERVER
  442. * 4: bt
  443. *
  444. * @note None
  445. */
  446. int tls_wifi_get_oneshot_flag(void);
  447. /** callback function of oneshot result */
  448. typedef void (*tls_wifi_oneshot_result_callback)(enum tls_wifi_oneshot_result_type type);
  449. /**
  450. * @brief before calling tls_wifi_get_oneshot_ssidpwd or tls_wifi_get_oneshot_customdata,
  451. * application should call this function to register the call back function
  452. *
  453. * @param[in] callback callback function pointer
  454. *
  455. * @return None
  456. *
  457. * @note None
  458. */
  459. void tls_wifi_oneshot_result_cb_register(tls_wifi_oneshot_result_callback callback);
  460. /**
  461. * @brief This function is used to get one shot ssid and password information.
  462. *
  463. * @param[in] ssid wifi name
  464. * @param[in] pwd pwssword
  465. *
  466. * @return None
  467. *
  468. * @note None
  469. */
  470. void tls_wifi_get_oneshot_ssidpwd(u8 *ssid, u8 *pwd);
  471. /**
  472. * @brief This function is used to get one shot custom data
  473. *
  474. * @param[in] data custom data
  475. *
  476. * @return None
  477. *
  478. * @note None
  479. */
  480. void tls_wifi_get_oneshot_customdata(u8 *data);
  481. /**
  482. * @brief This function is used to change channel actively
  483. *
  484. * @param[in] chanid
  485. *
  486. * @return None
  487. *
  488. * @note Normally, it is just used in listen mode;
  489. */
  490. void tls_wifi_change_chanel(u32 chanid);
  491. /**
  492. * @brief This function is used to trigger scan AP
  493. *
  494. * @param None
  495. *
  496. * @retval WM_SUCCESS start scan
  497. * @retval WM_WIFI_SCANNING_BUSY scanning
  498. * @retval WM_FAILED failed
  499. *
  500. * @note If not SUCCESS, user needs to call this function again
  501. * to trigger scan
  502. */
  503. int tls_wifi_scan(void);
  504. /**
  505. * @brief This function is used to trigger scan AP
  506. *
  507. * @param None
  508. *
  509. * @retval WM_SUCCESS start scan
  510. * @retval WM_WIFI_SCANNING_BUSY scanning
  511. * @retval WM_FAILED failed
  512. *
  513. * @note If not SUCCESS, user needs to call this function again
  514. * to trigger scan
  515. */
  516. int tls_wifi_passive_scan(void);
  517. /**
  518. * @brief scan AP ,user can set channellist,scan times and switch interval per channel
  519. *
  520. * @param[in] scan_param
  521. * scan_param member
  522. * scan_times: scan times, >=0, if zero, only 1 times
  523. * scan_chanlist: scan channel list ,[0,3FFF],per bit is one channel,if zero or above 0x3FFF, scan all channel
  524. * scan_chinterval: scan channel switch time if zero, use default value. when value is non-zero,if input value >=20 use it, else input value <20 use 20, unit:ms
  525. *
  526. * @retval WM_SUCCESS will start scan
  527. * @retval WM_WIFI_SCANNING_BUSY wifi module is scanning now
  528. * @retval WM_FAILED other Error
  529. *
  530. * @note in case not SUCCESS, user need to call this function again to trigger the scan
  531. */
  532. int tls_wifi_scan_by_param(struct tls_wifi_scan_param_t *scan_param);
  533. /**
  534. * @brief Before calling tls_wifi_scan() , application should call
  535. * this function to register the call back function;
  536. *
  537. * @param[in] callback point to callback function
  538. *
  539. * @return None
  540. *
  541. * @note In callback function, user should send a message
  542. * and return immediately.
  543. * After callback called, scan result can be get by
  544. * calling function tls_wifi_get_scan_rslt
  545. */
  546. void tls_wifi_scan_result_cb_register(void (*callback)(void));
  547. /**
  548. * @brief This function is used to get scan result
  549. *
  550. * @param[out] buf buf to be used to store returned BSS info
  551. * @param[in] buffer_size buf size
  552. *
  553. * @retval WM_SUCCESS success
  554. * @retval WM_FAILED failed
  555. *
  556. * @note User need to alloc buffer in advance.
  557. * One item of scan result is @ref struct tls_bss_info_t.
  558. * Size for one item of scan result is 48Bytes;
  559. * The buffer size depends how many items user wants.
  560. * Compared with the previous scanning results,
  561. * max_data_rate and wps_support fields were added,
  562. * and the meaning of the privacy field was extended.
  563. */
  564. int tls_wifi_get_scan_rslt(u8* buf, u32 buffer_size);
  565. /**
  566. * @brief This function is used to create soft ap
  567. *
  568. * @param[in] apinfo softap Wi-Fi configuration
  569. * @param[in] ipinfo softap ip address
  570. *
  571. * @retval WM_WIFI_ERR_SSID SSID is NULL
  572. * @retval WM_WIFI_ERR_KEY key info not correct
  573. * @retval WM_SUCCESS soft ap create OK
  574. * @retval WM_WIFI_STA_BUSY station is connecting
  575. *
  576. * @note None
  577. */
  578. int tls_wifi_softap_create(struct tls_softap_info_t* apinfo, struct tls_ip_info_t* ipinfo);
  579. /**
  580. * @brief This function is used to destroy soft ap
  581. *
  582. * @param None
  583. *
  584. * @return None
  585. *
  586. * @note None
  587. */
  588. void tls_wifi_softap_destroy(void);
  589. /**
  590. * @brief This function is used to get soft ap's state
  591. *
  592. * @param None
  593. *
  594. * @return softap's state, @ref tls_wifi_states
  595. *
  596. * @note None
  597. */
  598. enum tls_wifi_states tls_wifi_softap_get_state(void);
  599. /** callback function of wifi client event */
  600. typedef void (*tls_wifi_client_event_callback)(u8 *mac, enum tls_wifi_client_event_type event);
  601. /**
  602. * @brief This function is used to register client event
  603. *
  604. * @param[in] client event callback
  605. *
  606. * @return None
  607. *
  608. * @note None
  609. */
  610. void tls_wifi_softap_client_event_register(tls_wifi_client_event_callback callback);
  611. /**
  612. * @brief This function is used to get the authed sta list
  613. *
  614. * @param[out] sta_num the authed's station number
  615. *
  616. * @param[out] buf address to store returned station list info(struct tls_sta_info_t[])
  617. *
  618. * @param[in] buf_size
  619. *
  620. * @return None
  621. *
  622. * @note None
  623. */
  624. void tls_wifi_get_authed_sta_info(u32 *sta_num, u8 *buf, u32 buf_size);
  625. /**
  626. * @brief This function is used to create or join ibss
  627. *
  628. * @param[in] *ibssinfo ibss Wi-Fi configuration
  629. * @param[in] *ipinfo ibss ip address
  630. *
  631. * @retval WM_SUCCESS IBSS join or create ok
  632. * @retval WM_WIFI_ERR_SSID SSID is NULL
  633. * @retval WM_WIFI_ERR_KEY key info not correct
  634. *
  635. * @note Join IBSS if existed
  636. * Create IBSS by SSID when not existed.
  637. */
  638. int tls_wifi_ibss_create(struct tls_ibss_info_t *ibssinfo, struct tls_ibssip_info_t *ipinfo);
  639. /**
  640. * @brief This function is used to destroy or leave Wi-Fi network
  641. *
  642. * @param None
  643. *
  644. * @return None
  645. *
  646. * @note For AP, destroy soft AP
  647. * For STA, leave the network by AP
  648. * For IBSS, destroy or leave the IBSS network.
  649. */
  650. void tls_wifi_disconnect(void);
  651. /* void *connectinfo (about 1024 bytes buf) */
  652. int tls_wifi_faslink_connect(void *connectinfo);
  653. /* void *connectinfo (about 1024 bytes buf) */
  654. int tls_wifi_get_fastlink_info(void *connectinfo);
  655. /**
  656. * @brief This function is used to connect AP
  657. *
  658. * @param[in] *ssid Network Name to connect
  659. * @param[in] ssid_len length of SSID
  660. * @param[in] *pwd password to connect AP
  661. * @param[in] pwd_len length of password
  662. *
  663. * @retval WM_SUCCESS config ok, wifi will start to connect AP;
  664. * @retval WM_FAILED parameter wrong
  665. *
  666. * @note User should register Wi-Fi status callback function
  667. * to get result;
  668. * wifi_status_change_cb just return WIFI MAC layer status;
  669. * User should register netif status callback
  670. * to get TCP/IP layer status;
  671. */
  672. int tls_wifi_connect(u8 *ssid, u8 ssid_len, u8 *pwd, u8 pwd_len);
  673. /**
  674. * @brief This function is used to connect AP by BSSID
  675. *
  676. * @param[in] *bssid BSSID to connect
  677. * @param[in] *pwd password to connect AP
  678. * @param[in] pwd_len length of password
  679. *
  680. * @retval WM_SUCCESS success
  681. * @retval WM_FAILED failed
  682. *
  683. * @note When SSID hided,this function can not be used.
  684. * User should register Wi-Fi status callback function
  685. * to get result;
  686. * wifi_status_change_cb just return WIFI MAC layer status;
  687. * User should register netif status callback
  688. * to get TCP/IP layer status;
  689. */
  690. int tls_wifi_connect_by_bssid(u8 *bssid, u8 *pwd, u8 pwd_len);
  691. /**
  692. * @brief This function is used to connect AP by SSID an BSSID
  693. *
  694. * @param[in] *ssid Network Name to connect
  695. * @param[in] ssid_len length of SSID
  696. * @param[in] *bssid BSSID to connect with SSID
  697. * @param[in] *pwd password to connect AP
  698. * @param[in] pwd_len length of password
  699. *
  700. * @retval WM_SUCCESS success
  701. * @retval WM_FAILED failed
  702. *
  703. * @note When SSID&BSSID is knonw, user can use this function
  704. * to connect Wi-Fi AP.
  705. * User should register Wi-Fi status callback function
  706. * to get result;
  707. * wifi_status_change_cb just return WIFI MAC layer status;
  708. * User should register netif status callback
  709. * to get TCP/IP layer status;
  710. */
  711. int tls_wifi_connect_by_ssid_bssid(u8 *ssid, u8 ssid_len, u8 *bssid, u8 *pwd, u8 pwd_len );
  712. /**
  713. * @brief Set auto connect mode: Enable/Disable.
  714. * Get auto connect mode parameter
  715. *
  716. * @param[in] opt WIFI_AUTO_CNT_FLAG_SET or WIFI_AUTO_CNT_FLAG_GET
  717. * @param[in] mode WIFI_AUTO_CNT_OFF WIFI_AUTO_CNT_ON
  718. * or WIFI_AUTO_CNT_TMP_OFF
  719. *
  720. * @retval WM_SUCCESS success
  721. * @retval WM_FAILED failed
  722. *
  723. * @note WIFI_AUTO_CNT_OFF Disable/d;
  724. * WIFI_AUTO_CNT_ON Enable/d;
  725. * WIFI_AUTO_CNT_TMP_OFF For user initiated "DISCONNECT",
  726. * such as AT CMD; In such case, user might expect
  727. * "disconnect witout reconnection, even in WIFI_AUTO_CNT_ON
  728. * status; WIFI_AUTO_CNT_TMP_OFF flag just be effective
  729. * for one time of "DISCONNECT";
  730. * After that or reboot, the FLAG will be set to the previous value;
  731. */
  732. int tls_wifi_auto_connect_flag(u8 opt, u8* mode);
  733. /**
  734. * @brief This function is used to register wifi status changed callback function
  735. *
  736. * @param[in] callback point to wifi status function
  737. *
  738. * @return None
  739. *
  740. * @note
  741. * WIFI_JOIN_SUCCESS connect with wifi AP correctly in Wifi layer;
  742. * No IP address
  743. * WIFI_JOIN_FAILED did not connect with wifi AP;
  744. * normally, timeout in 20s after start connection
  745. * WIFI_DISCONNECTED STA is disconnected with AP for any case,
  746. * such as wifi AP shut dow, Wi-Fi AP
  747. * changed password, and so on;
  748. */
  749. void tls_wifi_status_change_cb_register(void (*callback)(u8 status));
  750. /**
  751. * @brief This function is used to get AP's info
  752. *
  753. * @param[out] bss address where the network parameters will be write;
  754. *
  755. * @return None
  756. *
  757. * @note None
  758. */
  759. void tls_wifi_get_current_bss(struct tls_curr_bss_t* bss);
  760. /*********************************************************************************************************
  761. Wifi WPS API
  762. *********************************************************************************************************/
  763. #ifdef TLS_CONFIG_WPS
  764. /**
  765. * @brief This function generate random PIN code
  766. *
  767. * @param[out] pin buf to store pin code, WPS_PIN_LEN Bytes
  768. *
  769. * @retval WM_SUCCESS success
  770. * @retval other failed
  771. *
  772. * @note None
  773. */
  774. int tls_wps_get_pin(u8* pin);
  775. /**
  776. * @brief set PIN code into system
  777. *
  778. * @param[in] pin 8bytes string
  779. * @param[in] pin_len length of pin, should be 8 by current WPS spec
  780. *
  781. * @retval WM_SUCCESS success
  782. * @retval WM_FAILED failed
  783. *
  784. * @note normally, the @pin code will be hard coded during manufacturing. should not use this function;
  785. */
  786. int tls_wps_set_pin(u8* pin, u8 pin_len);
  787. /**
  788. * @brief Start WPS process via PIN mode
  789. *
  790. * @param None
  791. *
  792. * @retval WM_SUCCESS success
  793. * @retval WM_FAILED failed
  794. * @retval WM_WIFI_WPS_BUSY last WPS process is not finished;
  795. *
  796. * @note Normally, 120s for WPS protocol, but for us, 180s totally;
  797. * Adapter will use the PIN code in system for WPS process
  798. * and before that, the PIN code should be input
  799. * into AP/Registrar mannually
  800. */
  801. int tls_wps_start_pin(void);
  802. /**
  803. * @brief Start WPS process via PBC/PushButton mode
  804. *
  805. * @param None
  806. *
  807. * @retval WM_SUCCESS success
  808. * @retval WM_FAILED failed
  809. * @retval WM_WIFI_WPS_BUSY last WPS process is not finished;
  810. *
  811. * @note Normally, 120s for WPS protocol, but for us, 180s totally;
  812. * if OK, adaptor will start the WPS connection;
  813. * APP should register Wi-Fi/netif status callback to get result
  814. */
  815. int tls_wps_start_pbc(void);
  816. #endif
  817. /**
  818. * @brief This function is used to register ETHERNET data rx callback function
  819. *
  820. * @param[in] callback point to receive ETHERNET data function
  821. *
  822. * @return None
  823. *
  824. * @note None
  825. */
  826. void tls_ethernet_data_rx_callback(net_rx_data_cb callback);
  827. #if TLS_CONFIG_AP_OPT_FWD
  828. /**
  829. * @brief This function is used to forward IP data packets
  830. * by routing, only for APSTA mode.
  831. *
  832. * @param[in] callback point to receive ETHERNET data function
  833. *
  834. * @return None
  835. *
  836. * @note Only in APSTA mode, this function to deal with IP data
  837. */
  838. void tls_ethernet_ip_rx_callback(net_rx_data_cb callback);
  839. #endif
  840. /**
  841. * @brief This function is used to set powersave flag
  842. *
  843. * @param[in] enable non-zero: enable 0: disable
  844. * @param[in] alwaysflag 0: only once, lost when restart; !0: always
  845. *
  846. * @return None
  847. *
  848. * @note None
  849. */
  850. void tls_wifi_set_psflag(bool enable, bool alwaysflag);
  851. /**
  852. * @brief This function is used to get current powersave flag
  853. *
  854. * @param None
  855. *
  856. * @retval 0 power-saving disable
  857. * @retval non-zero power-saving enable
  858. *
  859. * @note None
  860. */
  861. u32 tls_wifi_get_psflag(void);
  862. /**
  863. * @brief This function is used to send oneshot data to other sta
  864. *
  865. * @param[in] *dst NULL , send broadcast info
  866. * !NULL, send unicast info
  867. * @param[in] *ssid SSID to be sent
  868. * @param[in] ssid_len SSID length to be sent
  869. *
  870. * @return None
  871. *
  872. * @note None
  873. */
  874. void tls_wifi_send_oneshotdata(u8 *dst, const u8 *ssid, u8 ssid_len);
  875. /**
  876. * @brief This function is used to get max gain by rate index
  877. *
  878. * @param[in] tx_rate rate index (enum)
  879. *
  880. * @retval Max Gain
  881. *
  882. * @note None
  883. */
  884. u8 tls_wifi_get_tx_gain_max(enum tls_wifi_tx_rate tx_rate);
  885. /**
  886. * @brief This function is used to send 802.11 management packet
  887. *
  888. * @param[in] type management packet type
  889. * @param[in] *mac mac address
  890. * @param[in] *ie information elements, if have no ie can fill NULL
  891. * @param[in] ie_len information elements length, it's zero if ie is NULL.
  892. * @param[in] *tx rate and gain to transfer
  893. *
  894. * @retval 0 success
  895. * @retval other failed
  896. *
  897. * @note None
  898. */
  899. int tls_wifi_send_mgmt(enum tls_wifi_mgmt_type type, struct tls_wifi_hdr_mac_t *mac, u8 *ie, u16 ie_len, struct tls_wifi_tx_rate_t *tx);
  900. /**
  901. * @brief This function is used to send an 802.11 frame
  902. *
  903. * @param[in] *mac mac address, it can be NULL
  904. * @param[in] *data data packet buffer
  905. * @param[in] data_len data packet length
  906. * @param[in] *tx rate and gain, it can be NULL
  907. *
  908. * @retval 0 success
  909. * @retval other failed
  910. *
  911. * @note If the @*mac is NULL, @*data should be an entire 802.11 frame.
  912. * If the @*mac is not NULL, this function will build an 802.11 frame
  913. * with @*mac as destination mac address and @*data as the data body.
  914. * If the @*tx is NULL, the packet will be sent at 11B 1Mbps.
  915. */
  916. int tls_wifi_send_data(struct tls_wifi_hdr_mac_t *mac, u8 *data, u16 data_len, struct tls_wifi_tx_rate_t *tx);
  917. #if TLS_CONFIG_AP
  918. /**
  919. * @brief This function is used to get authed sta list
  920. *
  921. * @param[out] *sta_num authed's station number
  922. * @param[out] *buf address to store returned station list info, tls_sta_info_t
  923. * @param[in] buf_size buffer size
  924. *
  925. * @return None
  926. *
  927. * @note None
  928. */
  929. void tls_wifi_get_authed_sta_info(u32 *sta_num, u8 *buf, u32 buf_size);
  930. #endif
  931. /**
  932. * @brief This function is used to get current Wi-Fi State
  933. *
  934. * @param None
  935. *
  936. * @retval Wi-Fi State, @ref tls_wifi_states
  937. *
  938. * @note None
  939. */
  940. enum tls_wifi_states tls_wifi_get_state(void);
  941. /**
  942. * @brief This function is used to get current error number during joining AP
  943. *
  944. * @param None
  945. *
  946. * @retval Error Number(WM_WIFI_ENOERR,WM_WIFI_ENOAP,
  947. * WM_WIFI_EKEY,WM_WIFI_ELSI)
  948. *
  949. * @note None
  950. */
  951. int tls_wifi_get_errno(void);
  952. /**
  953. * @brief This function is used to print current error during joining AP
  954. *
  955. * @param[in] *info prefix information
  956. *
  957. * @return None
  958. *
  959. * @note None
  960. */
  961. void tls_wifi_perror(const char *info);
  962. /**
  963. * @brief This function is used to get wifi error
  964. *
  965. * @param[in] eno error number(WM_WIFI_ENOERR,WM_WIFI_ENOAP,
  966. * WM_WIFI_EKEY,WM_WIFI_ELSI)
  967. *
  968. * @retval error description
  969. *
  970. * @note None
  971. */
  972. const char *tls_wifi_get_errinfo(int eno);
  973. /**
  974. * @brief This function is used to customize wifi tx&rx memory
  975. *
  976. * @param[in] startmem: memory addr, only used from 0x20028000 to 0x20048000
  977. *
  978. * @param[in] txcnt: wifi tx buf cnt, non -zero value
  979. *
  980. * @param[in] rxcnt: wifi rx buf cnt, greater than 2 && lower than 30
  981. *
  982. * @retval 0 :successfullly
  983. * <0:failure
  984. *
  985. * @note None
  986. */
  987. int tls_wifi_mem_cfg(u32 startmem, u8 txcnt, u8 rxcnt);
  988. /**
  989. * @brief This function is used to set max sta num
  990. *
  991. * @param[in] ap_sta_num: can be accepted num for sta
  992. *
  993. * @retval 0 :successfullly
  994. * <0:failure if ap_sta_num is 0
  995. *
  996. * @note max sta num is 8, this function must be called before ap created.
  997. */
  998. int tls_wifi_softap_set_sta_num(unsigned char ap_sta_num);
  999. /**
  1000. * @brief This function is used to deauth sta connected to softap
  1001. *
  1002. * @param[in] hwaddr: sta's mac to deauth
  1003. *
  1004. * @retval 0 :successfullly
  1005. * <0:failure if hwaddr is null
  1006. *
  1007. * @note None
  1008. */
  1009. int tls_wifi_softap_del_station(unsigned char* hwaddr);
  1010. /**
  1011. * @brief This function is used to set some information display in the process of wifi networking
  1012. *
  1013. * @param[in] enable true: enable false: disable
  1014. *
  1015. * @return None
  1016. *
  1017. * @note None
  1018. */
  1019. void tls_wifi_enable_log(bool enable);
  1020. /**
  1021. * @brief This function is used to set temperature compensation flag
  1022. *
  1023. * @param[in] flag:0- close temperature compensation,non-zero-open temperature compensation
  1024. *
  1025. * @return None
  1026. *
  1027. * @note None
  1028. */
  1029. void tls_wifi_set_tempcomp_flag(int flag);
  1030. /**
  1031. * @brief This function is used to get temperature compensation flag
  1032. *
  1033. * @param[in] None
  1034. *
  1035. * @return flag: 0- no temperature compensation. non zero-temperature compensation valid
  1036. *
  1037. * @note None
  1038. */
  1039. u8 tls_wifi_get_tempcomp_flag(void);
  1040. /**
  1041. * @}
  1042. */
  1043. /**
  1044. * @}
  1045. */
  1046. int tls_wl_get_isr_count(void);
  1047. #endif /* TLS_WIFI_FUNC_H */