espconn.h 28 KB

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