espconn.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. /*
  2. * ESPRESSIF MIT License
  3. *
  4. * Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
  5. *
  6. * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
  7. * it is free of charge, to any person obtaining a copy of this software and associated
  8. * documentation files (the "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
  11. * to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all copies or
  14. * substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. *
  23. */
  24. #ifndef __ESPCONN_H__
  25. #define __ESPCONN_H__
  26. typedef sint8 err_t;
  27. typedef void *espconn_handle;
  28. typedef void (* espconn_connect_callback)(void *arg);
  29. typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
  30. /* Definitions for error constants. */
  31. #define ESPCONN_OK 0 /* No error, everything OK. */
  32. #define ESPCONN_MEM -1 /* Out of memory error. */
  33. #define ESPCONN_TIMEOUT -3 /* Timeout. */
  34. #define ESPCONN_RTE -4 /* Routing problem. */
  35. #define ESPCONN_INPROGRESS -5 /* Operation in progress */
  36. #define ESPCONN_MAXNUM -7 /* Total number exceeds the set maximum*/
  37. #define ESPCONN_ABRT -8 /* Connection aborted. */
  38. #define ESPCONN_RST -9 /* Connection reset. */
  39. #define ESPCONN_CLSD -10 /* Connection closed. */
  40. #define ESPCONN_CONN -11 /* Not connected. */
  41. #define ESPCONN_ARG -12 /* Illegal argument. */
  42. #define ESPCONN_IF -14 /* UDP send error */
  43. #define ESPCONN_ISCONN -15 /* Already connected. */
  44. #define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
  45. #define ESPCONN_SSL_INVALID_DATA -61 /* ssl application invalid */
  46. /** Protocol family and type of the espconn */
  47. enum espconn_type {
  48. ESPCONN_INVALID = 0,
  49. /* ESPCONN_TCP Group */
  50. ESPCONN_TCP = 0x10,
  51. /* ESPCONN_UDP Group */
  52. ESPCONN_UDP = 0x20,
  53. };
  54. /** Current state of the espconn. Non-TCP espconn are always in state ESPCONN_NONE! */
  55. enum espconn_state {
  56. ESPCONN_NONE,
  57. ESPCONN_WAIT,
  58. ESPCONN_LISTEN,
  59. ESPCONN_CONNECT,
  60. ESPCONN_WRITE,
  61. ESPCONN_READ,
  62. ESPCONN_CLOSE
  63. };
  64. typedef struct _esp_tcp {
  65. int remote_port;
  66. int local_port;
  67. uint8 local_ip[4];
  68. uint8 remote_ip[4];
  69. espconn_connect_callback connect_callback;
  70. espconn_reconnect_callback reconnect_callback;
  71. espconn_connect_callback disconnect_callback;
  72. espconn_connect_callback write_finish_fn;
  73. } esp_tcp;
  74. typedef struct _esp_udp {
  75. int remote_port;
  76. int local_port;
  77. uint8 local_ip[4];
  78. uint8 remote_ip[4];
  79. } esp_udp;
  80. typedef struct _remot_info{
  81. enum espconn_state state;
  82. int remote_port;
  83. uint8 remote_ip[4];
  84. }remot_info;
  85. /** A callback prototype to inform about events for a espconn */
  86. typedef void (* espconn_recv_callback)(void *arg, char *pdata, unsigned short len);
  87. typedef void (* espconn_sent_callback)(void *arg);
  88. /** A espconn descriptor */
  89. struct espconn {
  90. /** type of the espconn (TCP, UDP) */
  91. enum espconn_type type;
  92. /** current state of the espconn */
  93. enum espconn_state state;
  94. union {
  95. esp_tcp *tcp;
  96. esp_udp *udp;
  97. } proto;
  98. /** A callback function that is informed about events for this espconn */
  99. espconn_recv_callback recv_callback;
  100. espconn_sent_callback sent_callback;
  101. uint8 link_cnt;
  102. void *reverse;
  103. };
  104. enum espconn_option{
  105. ESPCONN_START = 0x00,
  106. ESPCONN_REUSEADDR = 0x01,
  107. ESPCONN_NODELAY = 0x02,
  108. ESPCONN_COPY = 0x04,
  109. ESPCONN_KEEPALIVE = 0x08,
  110. ESPCONN_END
  111. };
  112. enum espconn_level{
  113. ESPCONN_KEEPIDLE,
  114. ESPCONN_KEEPINTVL,
  115. ESPCONN_KEEPCNT
  116. };
  117. enum {
  118. ESPCONN_IDLE = 0,
  119. ESPCONN_CLIENT,
  120. ESPCONN_SERVER,
  121. ESPCONN_BOTH,
  122. ESPCONN_MAX
  123. };
  124. struct espconn_packet{
  125. uint16 sent_length; /* sent length successful*/
  126. uint16 snd_buf_size; /* Available buffer size for sending */
  127. uint16 snd_queuelen; /* Available buffer space for sending */
  128. uint16 total_queuelen; /* total Available buffer space for sending */
  129. uint32 packseqno; /* seqno to be sent */
  130. uint32 packseq_nxt; /* seqno expected */
  131. uint32 packnum;
  132. };
  133. struct mdns_info {
  134. char *host_name;
  135. char *server_name;
  136. uint16 server_port;
  137. unsigned long ipAddr;
  138. char *txt_data[10];
  139. };
  140. /******************************************************************************
  141. * FunctionName : espconn_connect
  142. * Description : The function given as the connect
  143. * Parameters : espconn -- the espconn used to listen the connection
  144. * Returns : none
  145. *******************************************************************************/
  146. sint8 espconn_connect(struct espconn *espconn);
  147. /******************************************************************************
  148. * FunctionName : espconn_disconnect
  149. * Description : disconnect with host
  150. * Parameters : espconn -- the espconn used to disconnect the connection
  151. * Returns : none
  152. *******************************************************************************/
  153. sint8 espconn_disconnect(struct espconn *espconn);
  154. /******************************************************************************
  155. * FunctionName : espconn_delete
  156. * Description : disconnect with host
  157. * Parameters : espconn -- the espconn used to disconnect the connection
  158. * Returns : none
  159. *******************************************************************************/
  160. sint8 espconn_delete(struct espconn *espconn);
  161. /******************************************************************************
  162. * FunctionName : espconn_accept
  163. * Description : The function given as the listen
  164. * Parameters : espconn -- the espconn used to listen the connection
  165. * Returns : none
  166. *******************************************************************************/
  167. sint8 espconn_accept(struct espconn *espconn);
  168. /******************************************************************************
  169. * FunctionName : espconn_create
  170. * Description : sent data for client or server
  171. * Parameters : espconn -- espconn to the data transmission
  172. * Returns : result
  173. *******************************************************************************/
  174. sint8 espconn_create(struct espconn *espconn);
  175. /******************************************************************************
  176. * FunctionName : espconn_tcp_get_max_con
  177. * Description : get the number of simulatenously active TCP connections
  178. * Parameters : none
  179. * Returns : none
  180. *******************************************************************************/
  181. uint8 espconn_tcp_get_max_con(void);
  182. /******************************************************************************
  183. * FunctionName : espconn_tcp_set_max_con
  184. * Description : set the number of simulatenously active TCP connections
  185. * Parameters : num -- total number
  186. * Returns : none
  187. *******************************************************************************/
  188. sint8 espconn_tcp_set_max_con(uint8 num);
  189. /******************************************************************************
  190. * FunctionName : espconn_tcp_get_max_con_allow
  191. * Description : get the count of simulatenously active connections on the server
  192. * Parameters : espconn -- espconn to get the count
  193. * Returns : result
  194. *******************************************************************************/
  195. sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);
  196. /******************************************************************************
  197. * FunctionName : espconn_tcp_set_max_con_allow
  198. * Description : set the count of simulatenously active connections on the server
  199. * Parameters : espconn -- espconn to set the count
  200. * num -- support the connection number
  201. * Returns : result
  202. *******************************************************************************/
  203. sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);
  204. /******************************************************************************
  205. * FunctionName : espconn_regist_time
  206. * Description : used to specify the time that should be called when don't recv data
  207. * Parameters : espconn -- the espconn used to the connection
  208. * interval -- the timer when don't recv data
  209. * Returns : none
  210. *******************************************************************************/
  211. sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag);
  212. /******************************************************************************
  213. * FunctionName : espconn_get_connection_info
  214. * Description : used to specify the function that should be called when disconnect
  215. * Parameters : espconn -- espconn to set the err callback
  216. * discon_cb -- err callback function to call when err
  217. * Returns : none
  218. *******************************************************************************/
  219. sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags);
  220. /******************************************************************************
  221. * FunctionName : espconn_get_packet_info
  222. * Description : get the packet info with host
  223. * Parameters : espconn -- the espconn used to disconnect the connection
  224. * infoarg -- the packet info
  225. * Returns : the errur code
  226. *******************************************************************************/
  227. sint8 espconn_get_packet_info(struct espconn *espconn, struct espconn_packet* infoarg);
  228. /******************************************************************************
  229. * FunctionName : espconn_regist_sentcb
  230. * Description : Used to specify the function that should be called when data
  231. * has been successfully delivered to the remote host.
  232. * Parameters : struct espconn *espconn -- espconn to set the sent callback
  233. * espconn_sent_callback sent_cb -- sent callback function to
  234. * call for this espconn when data is successfully sent
  235. * Returns : none
  236. *******************************************************************************/
  237. sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
  238. /******************************************************************************
  239. * FunctionName : espconn_regist_sentcb
  240. * Description : Used to specify the function that should be called when data
  241. * has been successfully delivered to the remote host.
  242. * Parameters : espconn -- espconn to set the sent callback
  243. * sent_cb -- sent callback function to call for this espconn
  244. * when data is successfully sent
  245. * Returns : none
  246. *******************************************************************************/
  247. sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);
  248. /******************************************************************************
  249. * FunctionName : espconn_send
  250. * Description : sent data for client or server
  251. * Parameters : espconn -- espconn to set for client or server
  252. * psent -- data to send
  253. * length -- length of data to send
  254. * Returns : none
  255. *******************************************************************************/
  256. sint8 espconn_send(struct espconn *espconn, uint8 *psent, uint16 length);
  257. /******************************************************************************
  258. * FunctionName : espconn_sent
  259. * Description : sent data for client or server
  260. * Parameters : espconn -- espconn to set for client or server
  261. * psent -- data to send
  262. * length -- length of data to send
  263. * Returns : none
  264. *******************************************************************************/
  265. sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
  266. /******************************************************************************
  267. * FunctionName : espconn_sendto
  268. * Description : send data for UDP
  269. * Parameters : espconn -- espconn to set for UDP
  270. * psent -- data to send
  271. * length -- length of data to send
  272. * Returns : error
  273. *******************************************************************************/
  274. sint16 espconn_sendto(struct espconn *espconn, uint8 *psent, uint16 length);
  275. /******************************************************************************
  276. * FunctionName : espconn_regist_connectcb
  277. * Description : used to specify the function that should be called when
  278. * connects to host.
  279. * Parameters : espconn -- espconn to set the connect callback
  280. * connect_cb -- connected callback function to call when connected
  281. * Returns : none
  282. *******************************************************************************/
  283. sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb);
  284. /******************************************************************************
  285. * FunctionName : espconn_regist_recvcb
  286. * Description : used to specify the function that should be called when recv
  287. * data from host.
  288. * Parameters : espconn -- espconn to set the recv callback
  289. * recv_cb -- recv callback function to call when recv data
  290. * Returns : none
  291. *******************************************************************************/
  292. sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb);
  293. /******************************************************************************
  294. * FunctionName : espconn_regist_reconcb
  295. * Description : used to specify the function that should be called when connection
  296. * because of err disconnect.
  297. * Parameters : espconn -- espconn to set the err callback
  298. * recon_cb -- err callback function to call when err
  299. * Returns : none
  300. *******************************************************************************/
  301. sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb);
  302. /******************************************************************************
  303. * FunctionName : espconn_regist_disconcb
  304. * Description : used to specify the function that should be called when disconnect
  305. * Parameters : espconn -- espconn to set the err callback
  306. * discon_cb -- err callback function to call when err
  307. * Returns : none
  308. *******************************************************************************/
  309. sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb);
  310. /******************************************************************************
  311. * FunctionName : espconn_port
  312. * Description : access port value for client so that we don't end up bouncing
  313. * all connections at the same time .
  314. * Parameters : none
  315. * Returns : access port value
  316. *******************************************************************************/
  317. uint32 espconn_port(void);
  318. /******************************************************************************
  319. * FunctionName : espconn_set_opt
  320. * Description : access port value for client so that we don't end up bouncing
  321. * all connections at the same time .
  322. * Parameters : none
  323. * Returns : access port value
  324. *******************************************************************************/
  325. sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);
  326. /******************************************************************************
  327. * FunctionName : espconn_clear_opt
  328. * Description : clear the option for connections so that we don't end up bouncing
  329. * all connections at the same time .
  330. * Parameters : espconn -- the espconn used to set the connection
  331. * opt -- the option for clear
  332. * Returns : the result
  333. *******************************************************************************/
  334. sint8 espconn_clear_opt(struct espconn *espconn, uint8 opt);
  335. /******************************************************************************
  336. * FunctionName : espconn_set_keepalive
  337. * Description : access level value for connection so that we set the value for
  338. * keep alive
  339. * Parameters : espconn -- the espconn used to set the connection
  340. * level -- the connection's level
  341. * value -- the value of time(s)
  342. * Returns : access port value
  343. *******************************************************************************/
  344. sint8 espconn_set_keepalive(struct espconn *espconn, uint8 level, void* optarg);
  345. /******************************************************************************
  346. * FunctionName : espconn_get_keepalive
  347. * Description : access level value for connection so that we get the value for
  348. * keep alive
  349. * Parameters : espconn -- the espconn used to get the connection
  350. * level -- the connection's level
  351. * Returns : access keep alive value
  352. *******************************************************************************/
  353. sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg);
  354. /******************************************************************************
  355. * TypedefName : dns_found_callback
  356. * Description : Callback which is invoked when a hostname is found.
  357. * Parameters : name -- pointer to the name that was looked up.
  358. * ipaddr -- pointer to an ip_addr_t containing the IP address of
  359. * the hostname, or NULL if the name could not be found (or on any
  360. * other error).
  361. * callback_arg -- a user-specified callback argument passed to
  362. * dns_gethostbyname
  363. *******************************************************************************/
  364. typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
  365. /******************************************************************************
  366. * FunctionName : espconn_gethostbyname
  367. * Description : Resolve a hostname (string) into an IP address.
  368. * Parameters : pespconn -- espconn to resolve a hostname
  369. * hostname -- the hostname that is to be queried
  370. * addr -- pointer to a ip_addr_t where to store the address if
  371. * it is already cached in the dns_table (only valid if ESPCONN_OK
  372. * is returned!)
  373. * found -- a callback function to be called on success, failure
  374. * or timeout (only if ERR_INPROGRESS is returned!)
  375. * Returns : err_t return code
  376. * - ESPCONN_OK if hostname is a valid IP address string or the host
  377. * name is already in the local names table.
  378. * - ESPCONN_INPROGRESS enqueue a request to be sent to the DNS server
  379. * for resolution if no errors are present.
  380. * - ESPCONN_ARG: dns client not initialized or invalid hostname
  381. *******************************************************************************/
  382. err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ip_addr_t *addr, dns_found_callback found);
  383. /******************************************************************************
  384. * FunctionName : espconn_abort
  385. * Description : Forcely abort with host
  386. * Parameters : espconn -- the espconn used to connect with the host
  387. * Returns : result
  388. *******************************************************************************/
  389. sint8 espconn_abort(struct espconn *espconn);
  390. /******************************************************************************
  391. * FunctionName : espconn_encry_connect
  392. * Description : The function given as connection
  393. * Parameters : espconn -- the espconn used to connect with the host
  394. * Returns : none
  395. *******************************************************************************/
  396. sint8 espconn_secure_connect(struct espconn *espconn);
  397. /******************************************************************************
  398. * FunctionName : espconn_encry_disconnect
  399. * Description : The function given as the disconnection
  400. * Parameters : espconn -- the espconn used to disconnect with the host
  401. * Returns : none
  402. *******************************************************************************/
  403. sint8 espconn_secure_disconnect(struct espconn *espconn);
  404. /******************************************************************************
  405. * FunctionName : espconn_secure_send
  406. * Description : sent data for client or server
  407. * Parameters : espconn -- espconn to set for client or server
  408. * psent -- data to send
  409. * length -- length of data to send
  410. * Returns : none
  411. *******************************************************************************/
  412. sint8 espconn_secure_send(struct espconn *espconn, uint8 *psent, uint16 length);
  413. /******************************************************************************
  414. * FunctionName : espconn_encry_sent
  415. * Description : sent data for client or server
  416. * Parameters : espconn -- espconn to set for client or server
  417. * psent -- data to send
  418. * length -- length of data to send
  419. * Returns : none
  420. *******************************************************************************/
  421. sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length);
  422. /******************************************************************************
  423. * FunctionName : espconn_secure_set_size
  424. * Description : set the buffer size for client or server
  425. * Parameters : level -- set for client or server
  426. * 1: client,2:server,3:client and server
  427. * size -- buffer size
  428. * Returns : true or false
  429. *******************************************************************************/
  430. bool espconn_secure_set_size(uint8 level, uint16 size);
  431. /******************************************************************************
  432. * FunctionName : espconn_secure_get_size
  433. * Description : get buffer size for client or server
  434. * Parameters : level -- set for client or server
  435. * 1: client,2:server,3:client and server
  436. * Returns : buffer size for client or server
  437. *******************************************************************************/
  438. sint16 espconn_secure_get_size(uint8 level);
  439. /******************************************************************************
  440. * FunctionName : espconn_secure_ca_enable
  441. * Description : enable the certificate authenticate and set the flash sector
  442. * as client or server
  443. * Parameters : level -- set for client or server
  444. * 1: client,2:server,3:client and server
  445. * flash_sector -- flash sector for save certificate
  446. * Returns : result true or false
  447. *******************************************************************************/
  448. bool espconn_secure_ca_enable(uint8 level, uint32 flash_sector );
  449. /******************************************************************************
  450. * FunctionName : espconn_secure_ca_disable
  451. * Description : disable the certificate authenticate as client or server
  452. * Parameters : level -- set for client or server
  453. * 1: client,2:server,3:client and server
  454. * Returns : result true or false
  455. *******************************************************************************/
  456. bool espconn_secure_ca_disable(uint8 level);
  457. /******************************************************************************
  458. * FunctionName : espconn_secure_cert_req_enable
  459. * Description : enable the client certificate authenticate and set the flash sector
  460. * as client or server
  461. * Parameters : level -- set for client or server
  462. * 1: client,2:server,3:client and server
  463. * flash_sector -- flash sector for save certificate
  464. * Returns : result true or false
  465. *******************************************************************************/
  466. bool espconn_secure_cert_req_enable(uint8 level, uint32 flash_sector );
  467. /******************************************************************************
  468. * FunctionName : espconn_secure_ca_disable
  469. * Description : disable the client certificate authenticate as client or server
  470. * Parameters : level -- set for client or server
  471. * 1: client,2:server,3:client and server
  472. * Returns : result true or false
  473. *******************************************************************************/
  474. bool espconn_secure_cert_req_disable(uint8 level);
  475. /******************************************************************************
  476. * FunctionName : espconn_secure_set_default_certificate
  477. * Description : Load the certificates in memory depending on compile-time
  478. * and user options.
  479. * Parameters : certificate -- Load the certificate
  480. * length -- Load the certificate length
  481. * Returns : result true or false
  482. *******************************************************************************/
  483. bool espconn_secure_set_default_certificate(const uint8* certificate, uint16 length);
  484. /******************************************************************************
  485. * FunctionName : espconn_secure_set_default_private_key
  486. * Description : Load the key in memory depending on compile-time
  487. * and user options.
  488. * Parameters : private_key -- Load the key
  489. * length -- Load the key length
  490. * Returns : result true or false
  491. *******************************************************************************/
  492. bool espconn_secure_set_default_private_key(const uint8* private_key, uint16 length);
  493. /******************************************************************************
  494. * FunctionName : espconn_secure_accept
  495. * Description : The function given as the listen
  496. * Parameters : espconn -- the espconn used to listen the connection
  497. * Returns : result
  498. *******************************************************************************/
  499. sint8 espconn_secure_accept(struct espconn *espconn);
  500. /******************************************************************************
  501. * FunctionName : espconn_secure_accepts
  502. * Description : delete the secure server host
  503. * Parameters : espconn -- the espconn used to listen the connection
  504. * Returns : result
  505. *******************************************************************************/
  506. sint8 espconn_secure_delete(struct espconn *espconn);
  507. /******************************************************************************
  508. * FunctionName : espconn_igmp_join
  509. * Description : join a multicast group
  510. * Parameters : host_ip -- the ip address of udp server
  511. * multicast_ip -- multicast ip given by user
  512. * Returns : none
  513. *******************************************************************************/
  514. sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
  515. /******************************************************************************
  516. * FunctionName : espconn_igmp_leave
  517. * Description : leave a multicast group
  518. * Parameters : host_ip -- the ip address of udp server
  519. * multicast_ip -- multicast ip given by user
  520. * Returns : none
  521. *******************************************************************************/
  522. sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
  523. /******************************************************************************
  524. * FunctionName : espconn_recv_hold
  525. * Description : hold tcp receive
  526. * Parameters : espconn -- espconn to hold
  527. * Returns : none
  528. *******************************************************************************/
  529. sint8 espconn_recv_hold(struct espconn *pespconn);
  530. /******************************************************************************
  531. * FunctionName : espconn_recv_unhold
  532. * Description : unhold tcp receive
  533. * Parameters : espconn -- espconn to unhold
  534. * Returns : none
  535. *******************************************************************************/
  536. sint8 espconn_recv_unhold(struct espconn *pespconn);
  537. /******************************************************************************
  538. * FunctionName : espconn_mdns_init
  539. * Description : register a device with mdns
  540. * Parameters : ipAddr -- the ip address of device
  541. * hostname -- the hostname of device
  542. * Returns : none
  543. *******************************************************************************/
  544. void espconn_mdns_init(struct mdns_info *info);
  545. /******************************************************************************
  546. * FunctionName : espconn_mdns_close
  547. * Description : close a device with mdns
  548. * Parameters : a
  549. * Returns : none
  550. *******************************************************************************/
  551. void espconn_mdns_close(void);
  552. /******************************************************************************
  553. * FunctionName : espconn_mdns_server_register
  554. * Description : register a device with mdns
  555. * Parameters : a
  556. * Returns : none
  557. *******************************************************************************/
  558. void espconn_mdns_server_register(void);
  559. /******************************************************************************
  560. * FunctionName : espconn_mdns_server_unregister
  561. * Description : unregister a device with mdns
  562. * Parameters : a
  563. * Returns : none
  564. *******************************************************************************/
  565. void espconn_mdns_server_unregister(void);
  566. /******************************************************************************
  567. * FunctionName : espconn_mdns_get_servername
  568. * Description : get server name of device with mdns
  569. * Parameters : a
  570. * Returns : none
  571. *******************************************************************************/
  572. char* espconn_mdns_get_servername(void);
  573. /******************************************************************************
  574. * FunctionName : espconn_mdns_set_servername
  575. * Description : set server name of device with mdns
  576. * Parameters : a
  577. * Returns : none
  578. *******************************************************************************/
  579. void espconn_mdns_set_servername(const char *name);
  580. /******************************************************************************
  581. * FunctionName : espconn_mdns_set_hostname
  582. * Description : set host name of device with mdns
  583. * Parameters : a
  584. * Returns : none
  585. *******************************************************************************/
  586. void espconn_mdns_set_hostname(char *name);
  587. /******************************************************************************
  588. * FunctionName : espconn_mdns_get_hostname
  589. * Description : get host name of device with mdns
  590. * Parameters : a
  591. * Returns : none
  592. *******************************************************************************/
  593. char* espconn_mdns_get_hostname(void);
  594. /******************************************************************************
  595. * FunctionName : espconn_mdns_disable
  596. * Description : disable a device with mdns
  597. * Parameters : a
  598. * Returns : none
  599. *******************************************************************************/
  600. void espconn_mdns_disable(void);
  601. /******************************************************************************
  602. * FunctionName : espconn_mdns_enable
  603. * Description : disable a device with mdns
  604. * Parameters : a
  605. * Returns : none
  606. *******************************************************************************/
  607. void espconn_mdns_enable(void);
  608. /******************************************************************************
  609. * FunctionName : espconn_dns_setserver
  610. * Description : Initialize one of the DNS servers.
  611. * Parameters : numdns -- the index of the DNS server to set must
  612. * be < DNS_MAX_SERVERS = 2
  613. * dnsserver -- IP address of the DNS server to set
  614. * Returns : none
  615. *******************************************************************************/
  616. void espconn_dns_setserver(uint8 numdns, ip_addr_t *dnsserver);
  617. /******************************************************************************
  618. * FunctionName : espconn_dns_getserver
  619. * Description : get dns server.
  620. * Parameters : numdns -- the index of the DNS server, must
  621. * be < DNS_MAX_SERVERS = 2
  622. * Returns : dnsserver -- IP address of the DNS server to set
  623. *******************************************************************************/
  624. ip_addr_t espconn_dns_getserver(uint8 numdns);
  625. #endif