espconn.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. #ifndef __ESPCONN_H__
  2. #define __ESPCONN_H__
  3. #include "lwip/dns.h"
  4. #include "os_type.h"
  5. #include "lwip/app/espconn_buf.h"
  6. #if 0
  7. #define espconn_printf(fmt, args...) os_printf(fmt,## args)
  8. #else
  9. #define espconn_printf(fmt, args...)
  10. #endif
  11. typedef void *espconn_handle;
  12. typedef void (* espconn_connect_callback)(void *arg);
  13. typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
  14. /* Definitions for error constants. */
  15. #define ESPCONN_OK 0 /* No error, everything OK. */
  16. #define ESPCONN_MEM -1 /* Out of memory error. */
  17. #define ESPCONN_TIMEOUT -3 /* Timeout. */
  18. #define ESPCONN_RTE -4 /* Routing problem. */
  19. #define ESPCONN_INPROGRESS -5 /* Operation in progress */
  20. #define ESPCONN_MAXNUM -7 /* Total number exceeds the set maximum*/
  21. #define ESPCONN_ABRT -8 /* Connection aborted. */
  22. #define ESPCONN_RST -9 /* Connection reset. */
  23. #define ESPCONN_CLSD -10 /* Connection closed. */
  24. #define ESPCONN_CONN -11 /* Not connected. */
  25. #define ESPCONN_ARG -12 /* Illegal argument. */
  26. #define ESPCONN_IF -14 /* Low_level error */
  27. #define ESPCONN_ISCONN -15 /* Already connected. */
  28. #define ESPCONN_TIME -16 /* Sync Time error */
  29. #define ESPCONN_NODATA -17 /* No data can be read */
  30. #define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
  31. #define ESPCONN_RESP_TIMEOUT -29 /* ssl handshake no response*/
  32. #define ESPCONN_PROTO_MSG -61 /* ssl application invalid */
  33. #define ESPCONN_SSL 0x01
  34. #define ESPCONN_NORM 0x00
  35. #define ESPCONN_STA 0x01
  36. #define ESPCONN_AP 0x02
  37. #define ESPCONN_AP_STA 0x03
  38. #define STA_NETIF 0x00
  39. #define AP_NETIF 0x01
  40. /** Protocol family and type of the espconn */
  41. enum espconn_type {
  42. ESPCONN_INVALID = 0,
  43. /* ESPCONN_TCP Group */
  44. ESPCONN_TCP = 0x10,
  45. /* ESPCONN_UDP Group */
  46. ESPCONN_UDP = 0x20,
  47. };
  48. /** Current state of the espconn. Non-TCP espconn are always in state ESPCONN_NONE! */
  49. enum espconn_state {
  50. ESPCONN_NONE,
  51. ESPCONN_WAIT,
  52. ESPCONN_LISTEN,
  53. ESPCONN_CONNECT,
  54. ESPCONN_WRITE,
  55. ESPCONN_READ,
  56. ESPCONN_CLOSE
  57. };
  58. typedef struct _esp_tcp {
  59. int remote_port;
  60. int local_port;
  61. uint8 local_ip[4];
  62. uint8 remote_ip[4];
  63. espconn_connect_callback connect_callback;
  64. espconn_reconnect_callback reconnect_callback;
  65. espconn_connect_callback disconnect_callback;
  66. espconn_connect_callback write_finish_fn;
  67. } esp_tcp;
  68. typedef struct _esp_udp {
  69. int remote_port;
  70. int local_port;
  71. uint8 local_ip[4];
  72. uint8 remote_ip[4];
  73. } esp_udp;
  74. typedef struct _remot_info{
  75. enum espconn_state state;
  76. int remote_port;
  77. uint8 remote_ip[4];
  78. }remot_info;
  79. /** A callback prototype to inform about events for a espconn */
  80. typedef void (* espconn_recv_callback)(void *arg, char *pdata, unsigned short len);
  81. typedef void (* espconn_sent_callback)(void *arg);
  82. /** A espconn descriptor */
  83. struct espconn {
  84. /** type of the espconn (TCP, UDP) */
  85. enum espconn_type type;
  86. /** current state of the espconn */
  87. enum espconn_state state;
  88. union {
  89. esp_tcp *tcp;
  90. esp_udp *udp;
  91. } proto;
  92. /** A callback function that is informed about events for this espconn */
  93. espconn_recv_callback recv_callback;
  94. espconn_sent_callback sent_callback;
  95. uint8 link_cnt;
  96. void *reverse;
  97. };
  98. enum espconn_option{
  99. ESPCONN_START = 0x00,
  100. ESPCONN_REUSEADDR = 0x01,
  101. ESPCONN_NODELAY = 0x02,
  102. ESPCONN_COPY = 0x04,
  103. ESPCONN_KEEPALIVE = 0x08,
  104. ESPCONN_END
  105. };
  106. enum espconn_level{
  107. ESPCONN_KEEPIDLE,
  108. ESPCONN_KEEPINTVL,
  109. ESPCONN_KEEPCNT
  110. };
  111. enum espconn_mode{
  112. ESPCONN_NOMODE,
  113. ESPCONN_TCPSERVER_MODE,
  114. ESPCONN_TCPCLIENT_MODE,
  115. ESPCONN_UDP_MODE,
  116. ESPCONN_NUM_MODE
  117. };
  118. struct espconn_packet{
  119. uint16 sent_length; /* sent length successful*/
  120. uint16 snd_buf_size; /* Available buffer size for sending */
  121. uint16 snd_queuelen; /* Available buffer space for sending */
  122. uint16 total_queuelen; /* total Available buffer space for sending */
  123. uint32 packseqno; /* seqno to be sent */
  124. uint32 packseq_nxt; /* seqno expected */
  125. uint32 packnum;
  126. };
  127. typedef struct _espconn_buf{
  128. uint8 *payload;
  129. uint8 *punsent;
  130. uint16 unsent;
  131. uint16 len;
  132. uint16 tot_len;
  133. struct _espconn_buf *pnext;
  134. } espconn_buf;
  135. typedef struct _comon_pkt{
  136. void *pcb;
  137. int remote_port;
  138. uint8 remote_ip[4];
  139. uint32 local_port;
  140. uint32 local_ip;
  141. espconn_buf *pbuf;
  142. espconn_buf *ptail;
  143. uint8* ptrbuf;
  144. uint16 cntr;
  145. sint8 err;
  146. uint32 timeout;
  147. uint32 recv_check;
  148. uint8 pbuf_num;
  149. struct espconn_packet packet_info;
  150. bool write_flag;
  151. enum espconn_option espconn_opt;
  152. }comon_pkt;
  153. typedef struct _espconn_msg{
  154. struct espconn *pespconn;
  155. comon_pkt pcommon;
  156. uint8 count_opt;
  157. uint8 espconn_mode;
  158. sint16_t hs_status; //the status of the handshake
  159. void *preverse;
  160. void *pssl;
  161. struct _espconn_msg *pnext;
  162. //***********Code for WIFI_BLOCK from upper**************
  163. uint8 recv_hold_flag;
  164. uint16 recv_holded_buf_Len;
  165. //*******************************************************
  166. ringbuf *readbuf;
  167. }espconn_msg;
  168. #ifndef _MDNS_INFO
  169. #define _MDNS_INFO
  170. struct mdns_info {
  171. char *host_name;
  172. char *server_name;
  173. uint16 server_port;
  174. unsigned long ipAddr;
  175. char *txt_data[10];
  176. };
  177. #endif
  178. #define linkMax 15
  179. #define espconn_delay_disabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_NODELAY) != 0)
  180. #define espconn_delay_enabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_NODELAY) == 0)
  181. #define espconn_reuse_disabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_REUSEADDR) != 0)
  182. #define espconn_copy_disabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_COPY) != 0)
  183. #define espconn_copy_enabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_COPY) == 0)
  184. #define espconn_keepalive_disabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_KEEPALIVE) != 0)
  185. #define espconn_keepalive_enabled(espconn) (((espconn)->pcommon.espconn_opt & ESPCONN_KEEPALIVE) == 0)
  186. #define espconn_TaskPrio 26
  187. #define espconn_TaskQueueLen 15
  188. enum espconn_sig {
  189. SIG_ESPCONN_NONE,
  190. SIG_ESPCONN_ERRER,
  191. SIG_ESPCONN_LISTEN,
  192. SIG_ESPCONN_CONNECT,
  193. SIG_ESPCONN_WRITE,
  194. SIG_ESPCONN_SEND,
  195. SIG_ESPCONN_READ,
  196. SIG_ESPCONN_CLOSE
  197. };
  198. /******************************************************************************
  199. * FunctionName : espconn_copy_partial
  200. * Description : reconnect with host
  201. * Parameters : arg -- Additional argument to pass to the callback function
  202. * Returns : none
  203. *******************************************************************************/
  204. void espconn_copy_partial(struct espconn *pesp_dest, struct espconn *pesp_source);
  205. /******************************************************************************
  206. * FunctionName : espconn_copy_partial
  207. * Description : insert the node to the active connection list
  208. * Parameters : arg -- Additional argument to pass to the callback function
  209. * Returns : none
  210. *******************************************************************************/
  211. void espconn_list_creat(espconn_msg **phead, espconn_msg* pinsert);
  212. /******************************************************************************
  213. * FunctionName : espconn_list_delete
  214. * Description : remove the node from the active connection list
  215. * Parameters : arg -- Additional argument to pass to the callback function
  216. * Returns : none
  217. *******************************************************************************/
  218. void espconn_list_delete(espconn_msg **phead, espconn_msg* pdelete);
  219. /******************************************************************************
  220. * FunctionName : espconn_find_connection
  221. * Description : Initialize the server: set up a listening PCB and bind it to
  222. * the defined port
  223. * Parameters : espconn -- the espconn used to build server
  224. * Returns : none
  225. *******************************************************************************/
  226. bool espconn_find_connection(struct espconn *pespconn, espconn_msg **pnode);
  227. /******************************************************************************
  228. * FunctionName : espconn_get_connection_info
  229. * Description : used to specify the function that should be called when disconnect
  230. * Parameters : espconn -- espconn to set the err callback
  231. * discon_cb -- err callback function to call when err
  232. * Returns : none
  233. *******************************************************************************/
  234. sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags);
  235. /******************************************************************************
  236. * FunctionName : espconn_get_packet_info
  237. * Description : get the packet info with host
  238. * Parameters : espconn -- the espconn used to disconnect the connection
  239. * infoarg -- the packet info
  240. * Returns : the errur code
  241. *******************************************************************************/
  242. sint8 espconn_get_packet_info(struct espconn *espconn, struct espconn_packet* infoarg);
  243. /******************************************************************************
  244. * FunctionName : espconn_connect
  245. * Description : The function given as the connect
  246. * Parameters : espconn -- the espconn used to listen the connection
  247. * Returns : none
  248. *******************************************************************************/
  249. extern sint8 espconn_connect(struct espconn *espconn);
  250. /******************************************************************************
  251. * FunctionName : espconn_disconnect
  252. * Description : disconnect with host
  253. * Parameters : espconn -- the espconn used to disconnect the connection
  254. * Returns : none
  255. *******************************************************************************/
  256. extern sint8 espconn_disconnect(struct espconn *espconn);
  257. /******************************************************************************
  258. * FunctionName : espconn_delete
  259. * Description : disconnect with host
  260. * Parameters : espconn -- the espconn used to disconnect the connection
  261. * Returns : none
  262. *******************************************************************************/
  263. extern sint8 espconn_delete(struct espconn *espconn);
  264. /******************************************************************************
  265. * FunctionName : espconn_accept
  266. * Description : The function given as the listen
  267. * Parameters : espconn -- the espconn used to listen the connection
  268. * Returns : none
  269. *******************************************************************************/
  270. extern sint8 espconn_accept(struct espconn *espconn);
  271. /******************************************************************************
  272. * FunctionName : espconn_create
  273. * Description : sent data for client or server
  274. * Parameters : espconn -- espconn to the data transmission
  275. * Returns : result
  276. *******************************************************************************/
  277. extern sint8 espconn_create(struct espconn *espconn);
  278. /******************************************************************************
  279. * FunctionName : espconn_tcp_get_wnd
  280. * Description : get the window size of simulatenously active TCP connections
  281. * Parameters : none
  282. * Returns : the number of TCP_MSS active TCP connections
  283. *******************************************************************************/
  284. extern uint8 espconn_tcp_get_wnd(void);
  285. /******************************************************************************
  286. * FunctionName : espconn_tcp_set_max_con
  287. * Description : set the window size simulatenously active TCP connections
  288. * Parameters : num -- the number of TCP_MSS
  289. * Returns : ESPCONN_ARG -- Illegal argument
  290. * ESPCONN_OK -- No error
  291. *******************************************************************************/
  292. extern sint8 espconn_tcp_set_wnd(uint8 num);
  293. /******************************************************************************
  294. * FunctionName : espconn_tcp_get_max_con
  295. * Description : get the number of simulatenously active TCP connections
  296. * Parameters : none
  297. * Returns : none
  298. *******************************************************************************/
  299. extern uint8 espconn_tcp_get_max_con(void);
  300. /******************************************************************************
  301. * FunctionName : espconn_tcp_set_max_con
  302. * Description : set the number of simulatenously active TCP connections
  303. * Parameters : num -- total number
  304. * Returns : none
  305. *******************************************************************************/
  306. extern sint8 espconn_tcp_set_max_con(uint8 num);
  307. /******************************************************************************
  308. * FunctionName : espconn_tcp_get_max_retran
  309. * Description : get the Maximum number of retransmissions of data active TCP connections
  310. * Parameters : none
  311. * Returns : the Maximum number of retransmissions
  312. *******************************************************************************/
  313. extern uint8 espconn_tcp_get_max_retran(void);
  314. /******************************************************************************
  315. * FunctionName : espconn_tcp_set_max_retran
  316. * Description : set the Maximum number of retransmissions of data active TCP connections
  317. * Parameters : num -- the Maximum number of retransmissions
  318. * Returns : result
  319. *******************************************************************************/
  320. extern sint8 espconn_tcp_set_max_retran(uint8 num);
  321. /******************************************************************************
  322. * FunctionName : espconn_tcp_get_max_syn
  323. * Description : get the Maximum number of retransmissions of SYN segments
  324. * Parameters : none
  325. * Returns : the Maximum number of retransmissions
  326. *******************************************************************************/
  327. extern uint8 espconn_tcp_get_max_syn(void);
  328. /******************************************************************************
  329. * FunctionName : espconn_tcp_set_max_syn
  330. * Description : set the Maximum number of retransmissions of SYN segments
  331. * Parameters : num -- the Maximum number of retransmissions
  332. * Returns : result
  333. *******************************************************************************/
  334. extern sint8 espconn_tcp_set_max_syn(uint8 num);
  335. /******************************************************************************
  336. * FunctionName : espconn_tcp_get_max_con_allow
  337. * Description : get the count of simulatenously active connections on the server
  338. * Parameters : espconn -- espconn to get the count
  339. * Returns : result
  340. *******************************************************************************/
  341. extern sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);
  342. /******************************************************************************
  343. * FunctionName : espconn_tcp_set_max_con_allow
  344. * Description : set the count of simulatenously active connections on the server
  345. * Parameters : espconn -- espconn to set the count
  346. * Returns : result
  347. *******************************************************************************/
  348. extern sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);
  349. /******************************************************************************
  350. * FunctionName : espconn_tcp_set_buf_count
  351. * Description : set the total number of espconn_buf on the unsent lists
  352. * Parameters : espconn -- espconn to set the count
  353. * num -- the total number of espconn_buf
  354. * Returns : result
  355. *******************************************************************************/
  356. extern sint8 espconn_tcp_set_buf_count(struct espconn *espconn, uint8 num);
  357. /******************************************************************************
  358. * FunctionName : espconn_regist_time
  359. * Description : used to specify the time that should be called when don't recv data
  360. * Parameters : espconn -- the espconn used to the connection
  361. * interval -- the timer when don't recv data
  362. * Returns : none
  363. *******************************************************************************/
  364. extern sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag);
  365. /******************************************************************************
  366. * FunctionName : espconn_regist_sentcb
  367. * Description : Used to specify the function that should be called when data
  368. * has been successfully delivered to the remote host.
  369. * Parameters : struct espconn *espconn -- espconn to set the sent callback
  370. * espconn_sent_callback sent_cb -- sent callback function to
  371. * call for this espconn when data is successfully sent
  372. * Returns : none
  373. *******************************************************************************/
  374. extern sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
  375. /******************************************************************************
  376. * FunctionName : espconn_regist_sentcb
  377. * Description : Used to specify the function that should be called when data
  378. * has been successfully delivered to the remote host.
  379. * Parameters : espconn -- espconn to set the sent callback
  380. * sent_cb -- sent callback function to call for this espconn
  381. * when data is successfully sent
  382. * Returns : none
  383. *******************************************************************************/
  384. extern sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn);
  385. /******************************************************************************
  386. * FunctionName : espconn_sent
  387. * Description : sent data for client or server
  388. * Parameters : espconn -- espconn to set for client or server
  389. * psent -- data to send
  390. * length -- length of data to send
  391. * Returns : none
  392. *******************************************************************************/
  393. extern sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
  394. /******************************************************************************
  395. * FunctionName : espconn_regist_connectcb
  396. * Description : used to specify the function that should be called when
  397. * connects to host.
  398. * Parameters : espconn -- espconn to set the connect callback
  399. * connect_cb -- connected callback function to call when connected
  400. * Returns : none
  401. *******************************************************************************/
  402. extern sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb);
  403. /******************************************************************************
  404. * FunctionName : espconn_regist_recvcb
  405. * Description : used to specify the function that should be called when recv
  406. * data from host.
  407. * Parameters : espconn -- espconn to set the recv callback
  408. * recv_cb -- recv callback function to call when recv data
  409. * Returns : none
  410. *******************************************************************************/
  411. extern sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb);
  412. /******************************************************************************
  413. * FunctionName : espconn_regist_reconcb
  414. * Description : used to specify the function that should be called when connection
  415. * because of err disconnect.
  416. * Parameters : espconn -- espconn to set the err callback
  417. * recon_cb -- err callback function to call when err
  418. * Returns : none
  419. *******************************************************************************/
  420. extern sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb);
  421. /******************************************************************************
  422. * FunctionName : espconn_regist_disconcb
  423. * Description : used to specify the function that should be called when disconnect
  424. * Parameters : espconn -- espconn to set the err callback
  425. * discon_cb -- err callback function to call when err
  426. * Returns : none
  427. *******************************************************************************/
  428. extern sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb);
  429. /******************************************************************************
  430. * FunctionName : espconn_port
  431. * Description : access port value for client so that we don't end up bouncing
  432. * all connections at the same time .
  433. * Parameters : none
  434. * Returns : access port value
  435. *******************************************************************************/
  436. extern uint32 espconn_port(void);
  437. /******************************************************************************
  438. * FunctionName : espconn_set_opt
  439. * Description : access port value for client so that we don't end up bouncing
  440. * all connections at the same time .
  441. * Parameters : none
  442. * Returns : access port value
  443. *******************************************************************************/
  444. extern sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);
  445. /******************************************************************************
  446. * FunctionName : espconn_set_keepalive
  447. * Description : access level value for connection so that we set the value for
  448. * keep alive
  449. * Parameters : espconn -- the espconn used to set the connection
  450. * level -- the connection's level
  451. * value -- the value of time(s)
  452. * Returns : access port value
  453. *******************************************************************************/
  454. extern sint8 espconn_set_keepalive(struct espconn *espconn, uint8 level, void* optarg);
  455. /******************************************************************************
  456. * FunctionName : espconn_get_keepalive
  457. * Description : access level value for connection so that we get the value for
  458. * keep alive
  459. * Parameters : espconn -- the espconn used to get the connection
  460. * level -- the connection's level
  461. * Returns : access keep alive value
  462. *******************************************************************************/
  463. extern sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg);
  464. /******************************************************************************
  465. * FunctionName : espconn_gethostbyname
  466. * Description : Resolve a hostname (string) into an IP address.
  467. * Parameters : pespconn -- espconn to resolve a hostname
  468. * hostname -- the hostname that is to be queried
  469. * addr -- pointer to a ip_addr_t where to store the address if
  470. * it is already cached in the dns_table (only valid if
  471. * ESPCONN_OK is returned!)
  472. * found -- a callback function to be called on success, failure
  473. * or timeout (only if ERR_INPROGRESS is returned!)
  474. * Returns : err_t return code
  475. * - ESPCONN_OK if hostname is a valid IP address string or the host
  476. * name is already in the local names table.
  477. * - ESPCONN_INPROGRESS enqueue a request to be sent to the DNS server
  478. * for resolution if no errors are present.
  479. * - ESPCONN_ARG: dns client not initialized or invalid hostname
  480. *******************************************************************************/
  481. extern sint8 espconn_gethostbyname(struct espconn *pespconn, const char *name, ip_addr_t *addr, dns_found_callback found);
  482. /******************************************************************************
  483. * FunctionName : espconn_igmp_join
  484. * Description : join a multicast group
  485. * Parameters : host_ip -- the ip address of udp server
  486. * multicast_ip -- multicast ip given by user
  487. * Returns : none
  488. *******************************************************************************/
  489. extern sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
  490. /******************************************************************************
  491. * FunctionName : espconn_igmp_leave
  492. * Description : leave a multicast group
  493. * Parameters : host_ip -- the ip address of udp server
  494. * multicast_ip -- multicast ip given by user
  495. * Returns : none
  496. *******************************************************************************/
  497. extern sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
  498. /******************************************************************************
  499. * FunctionName : espconn_mdns_init
  500. * Description : register a device with mdns
  501. * Parameters : ipAddr -- the ip address of device
  502. * hostname -- the hostname of device
  503. * Returns : none
  504. *******************************************************************************/
  505. extern void espconn_mdns_init(struct mdns_info *info);
  506. /******************************************************************************
  507. * FunctionName : espconn_mdns_init
  508. * Description : close mdns socket
  509. * Parameters : void
  510. * Returns : none
  511. *******************************************************************************/
  512. extern void espconn_mdns_close(void);
  513. /******************************************************************************
  514. * FunctionName : mdns_server_register
  515. * Description : register a server and join a multicast group
  516. * Parameters : none
  517. * Returns : none
  518. *******************************************************************************/
  519. extern void espconn_mdns_server_register(void);
  520. /******************************************************************************
  521. * FunctionName : mdns_server_register
  522. * Description : unregister server and leave multicast group
  523. * Parameters : none
  524. * Returns : none
  525. *******************************************************************************/
  526. extern void espconn_mdns_server_unregister(void);
  527. /******************************************************************************
  528. * FunctionName : espconn_mdns_get_servername
  529. * Description : get server name
  530. * Parameters : none
  531. * Returns : server name
  532. *******************************************************************************/
  533. extern char* espconn_mdns_get_servername(void);
  534. /******************************************************************************
  535. * FunctionName : espconn_mdns_get_servername
  536. * Description : set server name
  537. * Parameters : server name
  538. * Returns : none
  539. *******************************************************************************/
  540. extern void espconn_mdns_set_servername(const char *name);
  541. /******************************************************************************
  542. * FunctionName : espconn_mdns_set_hostname
  543. * Description : set host name
  544. * Parameters : host name
  545. * Returns : none
  546. *******************************************************************************/
  547. extern void espconn_mdns_set_hostname(char *name);
  548. /******************************************************************************
  549. * FunctionName : espconn_mdns_init
  550. * Description : get host name
  551. * Parameters : void
  552. * Returns : hostname
  553. *******************************************************************************/
  554. extern char* espconn_mdns_get_hostname(void);
  555. /******************************************************************************
  556. * FunctionName : espconn_mdns_disable
  557. * Description : join a multicast group
  558. * Parameters : host_ip -- the ip address of udp server
  559. * multicast_ip -- multicast ip given by user
  560. * Returns : none
  561. *******************************************************************************/
  562. extern void espconn_mdns_disable(void);
  563. /******************************************************************************
  564. * FunctionName : espconn_mdns_enable
  565. * Description : enable mdns
  566. * Parameters : void
  567. * Returns : none
  568. *******************************************************************************/
  569. extern void espconn_mdns_enable(void);
  570. /******************************************************************************
  571. * FunctionName : espconn_dns_setserver
  572. * Description : Initialize one of the DNS servers.
  573. * Parameters : numdns -- the index of the DNS server to set must
  574. * be < DNS_MAX_SERVERS = 2
  575. * dnsserver -- IP address of the DNS server to set
  576. * Returns : none
  577. *******************************************************************************/
  578. extern void espconn_dns_setserver(u8_t numdns, ip_addr_t *dnsserver);
  579. #endif