MeterLogger
espconn.h
Go to the documentation of this file.
1 /*
2  * ESPRSSIF 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 
25 #ifndef __ESPCONN_H__
26 #define __ESPCONN_H__
27 
28 typedef sint8 err_t;
29 
30 typedef void *espconn_handle;
31 typedef void (* espconn_connect_callback)(void *arg);
32 typedef void (* espconn_reconnect_callback)(void *arg, sint8 err);
33 
34 /* Definitions for error constants. */
35 
36 #define ESPCONN_OK 0 /* No error, everything OK. */
37 #define ESPCONN_MEM -1 /* Out of memory error. */
38 #define ESPCONN_TIMEOUT -3 /* Timeout. */
39 #define ESPCONN_RTE -4 /* Routing problem. */
40 #define ESPCONN_INPROGRESS -5 /* Operation in progress */
41 #define ESPCONN_MAXNUM -7 /* Total number exceeds the set maximum*/
42 
43 #define ESPCONN_ABRT -8 /* Connection aborted. */
44 #define ESPCONN_RST -9 /* Connection reset. */
45 #define ESPCONN_CLSD -10 /* Connection closed. */
46 #define ESPCONN_CONN -11 /* Not connected. */
47 
48 #define ESPCONN_ARG -12 /* Illegal argument. */
49 #define ESPCONN_IF -14 /* UDP send error */
50 #define ESPCONN_ISCONN -15 /* Already connected. */
51 
52 #define ESPCONN_HANDSHAKE -28 /* ssl handshake failed */
53 #define ESPCONN_SSL_INVALID_DATA -61 /* ssl application invalid */
54 
55 /** Protocol family and type of the espconn */
58  /* ESPCONN_TCP Group */
59  ESPCONN_TCP = 0x10,
60  /* ESPCONN_UDP Group */
61  ESPCONN_UDP = 0x20,
62 };
63 
64 /** Current state of the espconn. Non-TCP espconn are always in state ESPCONN_NONE! */
73 };
74 
75 typedef struct _esp_tcp {
76  int remote_port;
77  int local_port;
78  uint8 local_ip[4];
79  uint8 remote_ip[4];
84 } esp_tcp;
85 
86 typedef struct _esp_udp {
87  int remote_port;
88  int local_port;
89  uint8 local_ip[4];
90  uint8 remote_ip[4];
91 } esp_udp;
92 
93 typedef struct _remot_info{
94  enum espconn_state state;
95  int remote_port;
96  uint8 remote_ip[4];
97 }remot_info;
98 
99 /** A callback prototype to inform about events for a espconn */
100 typedef void (* espconn_recv_callback)(void *arg, char *pdata, unsigned short len);
101 typedef void (* espconn_sent_callback)(void *arg);
102 
103 /** A espconn descriptor */
104 struct espconn {
105  /** type of the espconn (TCP, UDP) */
106  enum espconn_type type;
107  /** current state of the espconn */
108  enum espconn_state state;
109  union {
110  esp_tcp *tcp;
111  esp_udp *udp;
112  } proto;
113  /** A callback function that is informed about events for this espconn */
114  espconn_recv_callback recv_callback;
115  espconn_sent_callback sent_callback;
116  uint8 link_cnt;
117  void *reverse;
118 };
119 
124  ESPCONN_COPY = 0x04,
127 };
128 
133 };
134 
135 enum {
141 };
142 
143 struct espconn_packet{
144  uint16 sent_length; /* sent length successful*/
145  uint16 snd_buf_size; /* Available buffer size for sending */
146  uint16 snd_queuelen; /* Available buffer space for sending */
147  uint16 total_queuelen; /* total Available buffer space for sending */
148  uint32 packseqno; /* seqno to be sent */
149  uint32 packseq_nxt; /* seqno expected */
150  uint32 packnum;
151 };
152 
153 struct mdns_info {
154  char *host_name;
155  char *server_name;
156  uint16 server_port;
157  unsigned long ipAddr;
158  char *txt_data[10];
159 };
160 /******************************************************************************
161  * FunctionName : espconn_connect
162  * Description : The function given as the connect
163  * Parameters : espconn -- the espconn used to listen the connection
164  * Returns : none
165 *******************************************************************************/
166 
168 
169 /******************************************************************************
170  * FunctionName : espconn_disconnect
171  * Description : disconnect with host
172  * Parameters : espconn -- the espconn used to disconnect the connection
173  * Returns : none
174 *******************************************************************************/
175 
176 sint8 espconn_disconnect(struct espconn *espconn);
177 
178 /******************************************************************************
179  * FunctionName : espconn_delete
180  * Description : disconnect with host
181  * Parameters : espconn -- the espconn used to disconnect the connection
182  * Returns : none
183 *******************************************************************************/
184 
185 sint8 espconn_delete(struct espconn *espconn);
186 
187 /******************************************************************************
188  * FunctionName : espconn_accept
189  * Description : The function given as the listen
190  * Parameters : espconn -- the espconn used to listen the connection
191  * Returns : none
192 *******************************************************************************/
193 
194 sint8 espconn_accept(struct espconn *espconn);
195 
196 /******************************************************************************
197  * FunctionName : espconn_create
198  * Description : sent data for client or server
199  * Parameters : espconn -- espconn to the data transmission
200  * Returns : result
201 *******************************************************************************/
202 
203 sint8 espconn_create(struct espconn *espconn);
204 
205 /******************************************************************************
206  * FunctionName : espconn_tcp_get_max_con
207  * Description : get the number of simulatenously active TCP connections
208  * Parameters : none
209  * Returns : none
210 *******************************************************************************/
211 
213 
214 /******************************************************************************
215  * FunctionName : espconn_tcp_set_max_con
216  * Description : set the number of simulatenously active TCP connections
217  * Parameters : num -- total number
218  * Returns : none
219 *******************************************************************************/
220 
222 
223 /******************************************************************************
224  * FunctionName : espconn_tcp_get_max_con_allow
225  * Description : get the count of simulatenously active connections on the server
226  * Parameters : espconn -- espconn to get the count
227  * Returns : result
228 *******************************************************************************/
229 
230 sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn);
231 
232 /******************************************************************************
233  * FunctionName : espconn_tcp_set_max_con_allow
234  * Description : set the count of simulatenously active connections on the server
235  * Parameters : espconn -- espconn to set the count
236  * num -- support the connection number
237  * Returns : result
238 *******************************************************************************/
239 
240 sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num);
241 
242 /******************************************************************************
243  * FunctionName : espconn_regist_time
244  * Description : used to specify the time that should be called when don't recv data
245  * Parameters : espconn -- the espconn used to the connection
246  * interval -- the timer when don't recv data
247  * Returns : none
248 *******************************************************************************/
249 
250 sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag);
251 
252 /******************************************************************************
253  * FunctionName : espconn_get_connection_info
254  * Description : used to specify the function that should be called when disconnect
255  * Parameters : espconn -- espconn to set the err callback
256  * discon_cb -- err callback function to call when err
257  * Returns : none
258 *******************************************************************************/
259 
260 sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags);
261 
262 /******************************************************************************
263  * FunctionName : espconn_get_packet_info
264  * Description : get the packet info with host
265  * Parameters : espconn -- the espconn used to disconnect the connection
266  * infoarg -- the packet info
267  * Returns : the errur code
268 *******************************************************************************/
269 
270 sint8 espconn_get_packet_info(struct espconn *espconn, struct espconn_packet* infoarg);
271 
272 /******************************************************************************
273  * FunctionName : espconn_regist_sentcb
274  * Description : Used to specify the function that should be called when data
275  * has been successfully delivered to the remote host.
276  * Parameters : struct espconn *espconn -- espconn to set the sent callback
277  * espconn_sent_callback sent_cb -- sent callback function to
278  * call for this espconn when data is successfully sent
279  * Returns : none
280 *******************************************************************************/
281 
282 sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb);
283 
284 /******************************************************************************
285  * FunctionName : espconn_regist_sentcb
286  * Description : Used to specify the function that should be called when data
287  * has been successfully delivered to the remote host.
288  * Parameters : espconn -- espconn to set the sent callback
289  * sent_cb -- sent callback function to call for this espconn
290  * when data is successfully sent
291  * Returns : none
292 *******************************************************************************/
293 
295 
296 /******************************************************************************
297  * FunctionName : espconn_send
298  * Description : sent data for client or server
299  * Parameters : espconn -- espconn to set for client or server
300  * psent -- data to send
301  * length -- length of data to send
302  * Returns : none
303 *******************************************************************************/
304 
305 sint8 espconn_send(struct espconn *espconn, uint8 *psent, uint16 length);
306 
307 /******************************************************************************
308  * FunctionName : espconn_sent
309  * Description : sent data for client or server
310  * Parameters : espconn -- espconn to set for client or server
311  * psent -- data to send
312  * length -- length of data to send
313  * Returns : none
314 *******************************************************************************/
315 
316 sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length);
317 
318 /******************************************************************************
319  * FunctionName : espconn_sendto
320  * Description : send data for UDP
321  * Parameters : espconn -- espconn to set for UDP
322  * psent -- data to send
323  * length -- length of data to send
324  * Returns : error
325 *******************************************************************************/
326 
327 sint16 espconn_sendto(struct espconn *espconn, uint8 *psent, uint16 length);
328 
329 /******************************************************************************
330  * FunctionName : espconn_regist_connectcb
331  * Description : used to specify the function that should be called when
332  * connects to host.
333  * Parameters : espconn -- espconn to set the connect callback
334  * connect_cb -- connected callback function to call when connected
335  * Returns : none
336 *******************************************************************************/
337 
338 sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb);
339 
340 /******************************************************************************
341  * FunctionName : espconn_regist_recvcb
342  * Description : used to specify the function that should be called when recv
343  * data from host.
344  * Parameters : espconn -- espconn to set the recv callback
345  * recv_cb -- recv callback function to call when recv data
346  * Returns : none
347 *******************************************************************************/
348 
349 sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb);
350 
351 /******************************************************************************
352  * FunctionName : espconn_regist_reconcb
353  * Description : used to specify the function that should be called when connection
354  * because of err disconnect.
355  * Parameters : espconn -- espconn to set the err callback
356  * recon_cb -- err callback function to call when err
357  * Returns : none
358 *******************************************************************************/
359 
360 sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb);
361 
362 /******************************************************************************
363  * FunctionName : espconn_regist_disconcb
364  * Description : used to specify the function that should be called when disconnect
365  * Parameters : espconn -- espconn to set the err callback
366  * discon_cb -- err callback function to call when err
367  * Returns : none
368 *******************************************************************************/
369 
370 sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb);
371 
372 /******************************************************************************
373  * FunctionName : espconn_port
374  * Description : access port value for client so that we don't end up bouncing
375  * all connections at the same time .
376  * Parameters : none
377  * Returns : access port value
378 *******************************************************************************/
379 
380 uint32 espconn_port(void);
381 
382 /******************************************************************************
383  * FunctionName : espconn_set_opt
384  * Description : access port value for client so that we don't end up bouncing
385  * all connections at the same time .
386  * Parameters : none
387  * Returns : access port value
388 *******************************************************************************/
389 
390 sint8 espconn_set_opt(struct espconn *espconn, uint8 opt);
391 
392 /******************************************************************************
393  * FunctionName : espconn_clear_opt
394  * Description : clear the option for connections so that we don't end up bouncing
395  * all connections at the same time .
396  * Parameters : espconn -- the espconn used to set the connection
397  * opt -- the option for clear
398  * Returns : the result
399 *******************************************************************************/
400 
401 sint8 espconn_clear_opt(struct espconn *espconn, uint8 opt);
402 
403 /******************************************************************************
404  * FunctionName : espconn_set_keepalive
405  * Description : access level value for connection so that we set the value for
406  * keep alive
407  * Parameters : espconn -- the espconn used to set the connection
408  * level -- the connection's level
409  * value -- the value of time(s)
410  * Returns : access port value
411 *******************************************************************************/
412 
413 sint8 espconn_set_keepalive(struct espconn *espconn, uint8 level, void* optarg);
414 
415 /******************************************************************************
416  * FunctionName : espconn_get_keepalive
417  * Description : access level value for connection so that we get the value for
418  * keep alive
419  * Parameters : espconn -- the espconn used to get the connection
420  * level -- the connection's level
421  * Returns : access keep alive value
422 *******************************************************************************/
423 
424 sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg);
425 
426 /******************************************************************************
427  * TypedefName : dns_found_callback
428  * Description : Callback which is invoked when a hostname is found.
429  * Parameters : name -- pointer to the name that was looked up.
430  * ipaddr -- pointer to an ip_addr_t containing the IP address of
431  * the hostname, or NULL if the name could not be found (or on any
432  * other error).
433  * callback_arg -- a user-specified callback argument passed to
434  * dns_gethostbyname
435 *******************************************************************************/
436 
437 typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg);
438 
439 /******************************************************************************
440  * FunctionName : espconn_gethostbyname
441  * Description : Resolve a hostname (string) into an IP address.
442  * Parameters : pespconn -- espconn to resolve a hostname
443  * hostname -- the hostname that is to be queried
444  * addr -- pointer to a ip_addr_t where to store the address if
445  * it is already cached in the dns_table (only valid if ESPCONN_OK
446  * is returned!)
447  * found -- a callback function to be called on success, failure
448  * or timeout (only if ERR_INPROGRESS is returned!)
449  * Returns : err_t return code
450  * - ESPCONN_OK if hostname is a valid IP address string or the host
451  * name is already in the local names table.
452  * - ESPCONN_INPROGRESS enqueue a request to be sent to the DNS server
453  * for resolution if no errors are present.
454  * - ESPCONN_ARG: dns client not initialized or invalid hostname
455 *******************************************************************************/
456 
457 err_t espconn_gethostbyname(struct espconn *pespconn, const char *hostname, ip_addr_t *addr, dns_found_callback found);
458 
459 /******************************************************************************
460  * FunctionName : espconn_abort
461  * Description : Forcely abort with host
462  * Parameters : espconn -- the espconn used to connect with the host
463  * Returns : result
464 *******************************************************************************/
465 
466 sint8 espconn_abort(struct espconn *espconn);
467 
468 /******************************************************************************
469  * FunctionName : espconn_encry_connect
470  * Description : The function given as connection
471  * Parameters : espconn -- the espconn used to connect with the host
472  * Returns : none
473 *******************************************************************************/
474 
475 sint8 espconn_secure_connect(struct espconn *espconn);
476 
477 /******************************************************************************
478  * FunctionName : espconn_encry_disconnect
479  * Description : The function given as the disconnection
480  * Parameters : espconn -- the espconn used to disconnect with the host
481  * Returns : none
482 *******************************************************************************/
483 
484 sint8 espconn_secure_disconnect(struct espconn *espconn);
485 
486 /******************************************************************************
487  * FunctionName : espconn_secure_send
488  * Description : sent data for client or server
489  * Parameters : espconn -- espconn to set for client or server
490  * psent -- data to send
491  * length -- length of data to send
492  * Returns : none
493 *******************************************************************************/
494 
495 sint8 espconn_secure_send(struct espconn *espconn, uint8 *psent, uint16 length);
496 
497 /******************************************************************************
498  * FunctionName : espconn_encry_sent
499  * Description : sent data for client or server
500  * Parameters : espconn -- espconn to set for client or server
501  * psent -- data to send
502  * length -- length of data to send
503  * Returns : none
504 *******************************************************************************/
505 
506 sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length);
507 
508 /******************************************************************************
509  * FunctionName : espconn_secure_set_size
510  * Description : set the buffer size for client or server
511  * Parameters : level -- set for client or server
512  * 1: client,2:server,3:client and server
513  * size -- buffer size
514  * Returns : true or false
515 *******************************************************************************/
516 
517 bool espconn_secure_set_size(uint8 level, uint16 size);
518 
519 /******************************************************************************
520  * FunctionName : espconn_secure_get_size
521  * Description : get buffer size for client or server
522  * Parameters : level -- set for client or server
523  * 1: client,2:server,3:client and server
524  * Returns : buffer size for client or server
525 *******************************************************************************/
526 
528 
529 /******************************************************************************
530  * FunctionName : espconn_secure_ca_enable
531  * Description : enable the certificate authenticate and set the flash sector
532  * as client or server
533  * Parameters : level -- set for client or server
534  * 1: client,2:server,3:client and server
535  * flash_sector -- flash sector for save certificate
536  * Returns : result true or false
537 *******************************************************************************/
538 
539 bool espconn_secure_ca_enable(uint8 level, uint32 flash_sector );
540 
541 /******************************************************************************
542  * FunctionName : espconn_secure_ca_disable
543  * Description : disable the certificate authenticate as client or server
544  * Parameters : level -- set for client or server
545  * 1: client,2:server,3:client and server
546  * Returns : result true or false
547 *******************************************************************************/
548 
549 bool espconn_secure_ca_disable(uint8 level);
550 
551 
552 /******************************************************************************
553  * FunctionName : espconn_secure_cert_req_enable
554  * Description : enable the client certificate authenticate and set the flash sector
555  * as client or server
556  * Parameters : level -- set for client or server
557  * 1: client,2:server,3:client and server
558  * flash_sector -- flash sector for save certificate
559  * Returns : result true or false
560 *******************************************************************************/
561 
562 bool espconn_secure_cert_req_enable(uint8 level, uint32 flash_sector );
563 
564 /******************************************************************************
565  * FunctionName : espconn_secure_ca_disable
566  * Description : disable the client certificate authenticate as client or server
567  * Parameters : level -- set for client or server
568  * 1: client,2:server,3:client and server
569  * Returns : result true or false
570 *******************************************************************************/
571 
573 
574 /******************************************************************************
575  * FunctionName : espconn_secure_set_default_certificate
576  * Description : Load the certificates in memory depending on compile-time
577  * and user options.
578  * Parameters : certificate -- Load the certificate
579  * length -- Load the certificate length
580  * Returns : result true or false
581 *******************************************************************************/
582 
583 bool espconn_secure_set_default_certificate(const uint8* certificate, uint16 length);
584 
585 /******************************************************************************
586  * FunctionName : espconn_secure_set_default_private_key
587  * Description : Load the key in memory depending on compile-time
588  * and user options.
589  * Parameters : private_key -- Load the key
590  * length -- Load the key length
591  * Returns : result true or false
592 *******************************************************************************/
593 
594 bool espconn_secure_set_default_private_key(const uint8* private_key, uint16 length);
595 
596 /******************************************************************************
597  * FunctionName : espconn_secure_accept
598  * Description : The function given as the listen
599  * Parameters : espconn -- the espconn used to listen the connection
600  * Returns : result
601 *******************************************************************************/
602 
603 sint8 espconn_secure_accept(struct espconn *espconn);
604 
605 /******************************************************************************
606  * FunctionName : espconn_secure_accepts
607  * Description : delete the secure server host
608  * Parameters : espconn -- the espconn used to listen the connection
609  * Returns : result
610 *******************************************************************************/
611 
612 sint8 espconn_secure_delete(struct espconn *espconn);
613 
614 /******************************************************************************
615  * FunctionName : espconn_igmp_join
616  * Description : join a multicast group
617  * Parameters : host_ip -- the ip address of udp server
618  * multicast_ip -- multicast ip given by user
619  * Returns : none
620 *******************************************************************************/
621 sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
622 
623 /******************************************************************************
624  * FunctionName : espconn_igmp_leave
625  * Description : leave a multicast group
626  * Parameters : host_ip -- the ip address of udp server
627  * multicast_ip -- multicast ip given by user
628  * Returns : none
629 *******************************************************************************/
630 sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip);
631 
632 /******************************************************************************
633  * FunctionName : espconn_recv_hold
634  * Description : hold tcp receive
635  * Parameters : espconn -- espconn to hold
636  * Returns : none
637 *******************************************************************************/
638 sint8 espconn_recv_hold(struct espconn *pespconn);
639 
640 /******************************************************************************
641  * FunctionName : espconn_recv_unhold
642  * Description : unhold tcp receive
643  * Parameters : espconn -- espconn to unhold
644  * Returns : none
645 *******************************************************************************/
646 sint8 espconn_recv_unhold(struct espconn *pespconn);
647 
648 /******************************************************************************
649  * FunctionName : espconn_mdns_init
650  * Description : register a device with mdns
651  * Parameters : ipAddr -- the ip address of device
652  * hostname -- the hostname of device
653  * Returns : none
654 *******************************************************************************/
655 
656 void espconn_mdns_init(struct mdns_info *info);
657 /******************************************************************************
658  * FunctionName : espconn_mdns_close
659  * Description : close a device with mdns
660  * Parameters : a
661  * Returns : none
662 *******************************************************************************/
663 
664 void espconn_mdns_close(void);
665 /******************************************************************************
666  * FunctionName : espconn_mdns_server_register
667  * Description : register a device with mdns
668  * Parameters : a
669  * Returns : none
670 *******************************************************************************/
672 
673 /******************************************************************************
674  * FunctionName : espconn_mdns_server_unregister
675  * Description : unregister a device with mdns
676  * Parameters : a
677  * Returns : none
678 *******************************************************************************/
680 
681 /******************************************************************************
682  * FunctionName : espconn_mdns_get_servername
683  * Description : get server name of device with mdns
684  * Parameters : a
685  * Returns : none
686 *******************************************************************************/
687 
688 char* espconn_mdns_get_servername(void);
689 /******************************************************************************
690  * FunctionName : espconn_mdns_set_servername
691  * Description : set server name of device with mdns
692  * Parameters : a
693  * Returns : none
694 *******************************************************************************/
695 void espconn_mdns_set_servername(const char *name);
696 
697 /******************************************************************************
698  * FunctionName : espconn_mdns_set_hostname
699  * Description : set host name of device with mdns
700  * Parameters : a
701  * Returns : none
702 *******************************************************************************/
703 void espconn_mdns_set_hostname(char *name);
704 
705 /******************************************************************************
706  * FunctionName : espconn_mdns_get_hostname
707  * Description : get host name of device with mdns
708  * Parameters : a
709  * Returns : none
710 *******************************************************************************/
711 char* espconn_mdns_get_hostname(void);
712 
713 /******************************************************************************
714  * FunctionName : espconn_mdns_disable
715  * Description : disable a device with mdns
716  * Parameters : a
717  * Returns : none
718 *******************************************************************************/
719 void espconn_mdns_disable(void);
720 
721 /******************************************************************************
722  * FunctionName : espconn_mdns_enable
723  * Description : disable a device with mdns
724  * Parameters : a
725  * Returns : none
726 *******************************************************************************/
727 void espconn_mdns_enable(void);
728 /******************************************************************************
729  * FunctionName : espconn_dns_setserver
730  * Description : Initialize one of the DNS servers.
731  * Parameters : numdns -- the index of the DNS server to set must
732  * be < DNS_MAX_SERVERS = 2
733  * dnsserver -- IP address of the DNS server to set
734  * Returns : none
735 *******************************************************************************/
736 void espconn_dns_setserver(char numdns, ip_addr_t *dnsserver);
737 
738 #endif
739 
sint8 espconn_regist_sentcb(struct espconn *espconn, espconn_sent_callback sent_cb)
Definition: espconn.c:712
bool espconn_secure_ca_enable(uint8 level, uint32 flash_sector)
void espconn_mdns_disable(void)
Definition: espconn_mdns.c:37
void * espconn_handle
Definition: espconn.h:14
sint8 espconn_set_opt(struct espconn *espconn, uint8 opt)
Definition: espconn.c:1056
void espconn_mdns_set_hostname(char *name)
Definition: espconn_mdns.c:50
sint8 espconn_regist_recvcb(struct espconn *espconn, espconn_recv_callback recv_cb)
Definition: espconn.c:770
sint8 espconn_connect(struct espconn *espconn)
Definition: espconn.c:260
sint8 espconn_recv_hold(struct espconn *pespconn)
Definition: espconn_tcp.c:549
sint8 espconn_sent(struct espconn *espconn, uint8 *psent, uint16 length)
Definition: espconn.c:368
sint8 espconn_tcp_get_max_con_allow(struct espconn *espconn)
Definition: espconn.c:618
void espconn_mdns_init(struct mdns_info *info)
Definition: espconn_mdns.c:131
bool espconn_secure_set_size(uint8 level, uint16 size)
void espconn_dns_setserver(u8_t numdns, ip_addr_t *dnsserver)
Definition: espconn.c:1302
sint8 espconn_get_connection_info(struct espconn *pespconn, remot_info **pcon_info, uint8 typeflags)
Definition: espconn.c:825
int local_port
Definition: espconn.h:72
sint8 espconn_regist_reconcb(struct espconn *espconn, espconn_reconnect_callback recon_cb)
Definition: espconn.c:789
char * espconn_mdns_get_servername(void)
Definition: espconn_mdns.c:85
unsigned short uint16
Definition: c_types.h:50
void espconn_mdns_server_register(void)
Definition: espconn_mdns.c:96
uint8 remote_ip[4]
Definition: espconn.h:74
void espconn_mdns_server_unregister(void)
Definition: espconn_mdns.c:107
bool espconn_secure_cert_req_disable(uint8 level)
void(* espconn_connect_callback)(void *arg)
Definition: espconn.h:15
struct _remot_info remot_info
void(* espconn_recv_callback)(void *arg, char *pdata, unsigned short len)
Definition: espconn.h:95
void(* espconn_reconnect_callback)(void *arg, sint8 err)
Definition: espconn.h:16
int remote_port
Definition: espconn.h:71
espconn_connect_callback connect_callback
Definition: espconn.h:75
sint16 espconn_secure_get_size(uint8 level)
espconn_state
Definition: espconn.h:60
sint8 espconn_get_keepalive(struct espconn *espconn, uint8 level, void *optarg)
Definition: espconn.c:1173
sint8 espconn_send(struct espconn *espconn, uint8 *psent, uint16 length)
sint8 espconn_igmp_leave(ip_addr_t *host_ip, ip_addr_t *multicast_ip)
Definition: espconn_udp.c:396
sint8 espconn_disconnect(struct espconn *espconn)
Definition: espconn.c:942
void(* dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg)
Definition: espconn.h:437
void espconn_mdns_set_servername(const char *name)
Definition: espconn_mdns.c:74
sint8 espconn_recv_unhold(struct espconn *pespconn)
Definition: espconn_tcp.c:574
sint8 espconn_secure_sent(struct espconn *espconn, uint8 *psent, uint16 length)
static state_t * state
Definition: aes.c:67
signed short sint16
Definition: c_types.h:52
struct _esp_udp esp_udp
unsigned char uint8
Definition: c_types.h:45
s8_t err_t
Definition: err.h:47
char * espconn_mdns_get_hostname(void)
Definition: espconn_mdns.c:63
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
Definition: ip_addr.h:64
sint8 espconn_set_keepalive(struct espconn *espconn, uint8 level, void *optarg)
Definition: espconn.c:1128
sint8 espconn_regist_write_finish(struct espconn *espconn, espconn_connect_callback write_finish_fn)
Definition: espconn.c:732
bool espconn_secure_cert_req_enable(uint8 level, uint32 flash_sector)
void espconn_mdns_close(void)
Definition: espconn_mdns.c:119
bool espconn_secure_ca_disable(uint8 level)
sint8 espconn_regist_disconcb(struct espconn *espconn, espconn_connect_callback discon_cb)
Definition: espconn.c:807
sint8 err_t
Definition: espconn.h:28
sint8 espconn_secure_disconnect(struct espconn *espconn)
void(* espconn_sent_callback)(void *arg)
Definition: espconn.h:96
espconn_connect_callback write_finish_fn
Definition: espconn.h:78
sint8 espconn_secure_accept(struct espconn *espconn)
void espconn_mdns_enable(void)
Definition: espconn_mdns.c:25
sint8 espconn_accept(struct espconn *espconn)
Definition: espconn.c:875
bool espconn_secure_set_default_certificate(const uint8 *certificate, uint16 length)
sint8 espconn_secure_send(struct espconn *espconn, uint8 *psent, uint16 length)
espconn_level
Definition: espconn.h:124
sint8 espconn_delete(struct espconn *espconn)
Definition: espconn.c:1217
unsigned int uint32
Definition: c_types.h:54
sint8 espconn_abort(struct espconn *espconn)
Definition: espconn.c:972
espconn_type
Definition: espconn.h:51
sint8 espconn_secure_delete(struct espconn *espconn)
sint8 espconn_tcp_set_max_con(uint8 num)
Definition: espconn.c:543
uint8 local_ip[4]
Definition: espconn.h:73
bool espconn_secure_set_default_private_key(const uint8 *private_key, uint16 length)
espconn_option
Definition: espconn.h:115
uint8 espconn_tcp_get_max_con(void)
Definition: espconn.c:528
espconn_reconnect_callback reconnect_callback
Definition: espconn.h:76
sint16 espconn_sendto(struct espconn *espconn, uint8 *psent, uint16 length)
Definition: espconn.c:448
uint32 espconn_port(void)
Definition: espconn.c:1245
espconn_connect_callback disconnect_callback
Definition: espconn.h:77
sint8 espconn_regist_connectcb(struct espconn *espconn, espconn_connect_callback connect_cb)
Definition: espconn.c:751
sint8 espconn_get_packet_info(struct espconn *espconn, struct espconn_packet *infoarg)
Definition: espconn.c:1004
sint8 espconn_gethostbyname(struct espconn *pespconn, const char *name, ip_addr_t *addr, dns_found_callback found)
Definition: espconn.c:1288
signed char sint8
Definition: c_types.h:47
sint8 espconn_secure_connect(struct espconn *espconn)
sint8 espconn_clear_opt(struct espconn *espconn, uint8 opt)
Definition: espconn.c:1092
struct _esp_tcp esp_tcp
sint8 espconn_igmp_join(ip_addr_t *host_ip, ip_addr_t *multicast_ip)
Definition: espconn_udp.c:414
sint8 espconn_regist_time(struct espconn *espconn, uint32 interval, uint8 type_flag)
Definition: espconn.c:905
sint8 espconn_create(struct espconn *espconn)
Definition: espconn.c:334
sint8 espconn_tcp_set_max_con_allow(struct espconn *espconn, uint8 num)
Definition: espconn.c:640