103 |
} |
} |
104 |
#endif /* LWIP_UDP */ |
#endif /* LWIP_UDP */ |
105 |
#if LWIP_TCP |
#if LWIP_TCP |
106 |
/*-----------------------------------------------------------------------------------*/ |
|
107 |
static err_t |
static err_t |
108 |
recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) |
recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) |
109 |
{ |
{ |
134 |
return ERR_OK; |
return ERR_OK; |
135 |
} |
} |
136 |
|
|
137 |
/*-----------------------------------------------------------------------------------*/ |
|
138 |
static err_t |
static err_t |
139 |
poll_tcp(void *arg, struct tcp_pcb *pcb) |
poll_tcp(void *arg, struct tcp_pcb *pcb) |
140 |
{ |
{ |
148 |
} |
} |
149 |
return ERR_OK; |
return ERR_OK; |
150 |
} |
} |
151 |
/*-----------------------------------------------------------------------------------*/ |
|
152 |
static err_t |
static err_t |
153 |
sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len) |
sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len) |
154 |
{ |
{ |
165 |
|
|
166 |
return ERR_OK; |
return ERR_OK; |
167 |
} |
} |
168 |
/*-----------------------------------------------------------------------------------*/ |
|
169 |
static void |
static void |
170 |
err_tcp(void *arg, err_t err) |
err_tcp(void *arg, err_t err) |
171 |
{ |
{ |
196 |
sys_sem_signal(conn->sem); |
sys_sem_signal(conn->sem); |
197 |
} |
} |
198 |
} |
} |
199 |
/*-----------------------------------------------------------------------------------*/ |
|
200 |
static void |
static void |
201 |
setup_tcp(struct netconn *conn) |
setup_tcp(struct netconn *conn) |
202 |
{ |
{ |
209 |
tcp_poll(pcb, poll_tcp, 4); |
tcp_poll(pcb, poll_tcp, 4); |
210 |
tcp_err(pcb, err_tcp); |
tcp_err(pcb, err_tcp); |
211 |
} |
} |
212 |
/*-----------------------------------------------------------------------------------*/ |
|
213 |
static err_t |
static err_t |
214 |
accept_function(void *arg, struct tcp_pcb *newpcb, err_t err) |
accept_function(void *arg, struct tcp_pcb *newpcb, err_t err) |
215 |
{ |
{ |
265 |
return ERR_OK; |
return ERR_OK; |
266 |
} |
} |
267 |
#endif /* LWIP_TCP */ |
#endif /* LWIP_TCP */ |
268 |
/*-----------------------------------------------------------------------------------*/ |
|
269 |
static void |
static void |
270 |
do_newconn(struct api_msg_msg *msg) |
do_newconn(struct api_msg_msg *msg) |
271 |
{ |
{ |
331 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
332 |
} |
} |
333 |
|
|
334 |
/*-----------------------------------------------------------------------------------*/ |
|
335 |
static void |
static void |
336 |
do_delconn(struct api_msg_msg *msg) |
do_delconn(struct api_msg_msg *msg) |
337 |
{ |
{ |
384 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
385 |
} |
} |
386 |
} |
} |
387 |
/*-----------------------------------------------------------------------------------*/ |
|
388 |
static void |
static void |
389 |
do_bind(struct api_msg_msg *msg) |
do_bind(struct api_msg_msg *msg) |
390 |
{ |
{ |
447 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
448 |
} |
} |
449 |
#if LWIP_TCP |
#if LWIP_TCP |
450 |
/*-----------------------------------------------------------------------------------*/ |
|
451 |
static err_t |
static err_t |
452 |
do_connected(void *arg, struct tcp_pcb *pcb, err_t err) |
do_connected(void *arg, struct tcp_pcb *pcb, err_t err) |
453 |
{ |
{ |
467 |
return ERR_OK; |
return ERR_OK; |
468 |
} |
} |
469 |
#endif |
#endif |
470 |
/*-----------------------------------------------------------------------------------*/ |
|
471 |
static void |
static void |
472 |
do_connect(struct api_msg_msg *msg) |
do_connect(struct api_msg_msg *msg) |
473 |
{ |
{ |
579 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
580 |
} |
} |
581 |
|
|
582 |
/*-----------------------------------------------------------------------------------*/ |
|
583 |
static void |
static void |
584 |
do_listen(struct api_msg_msg *msg) |
do_listen(struct api_msg_msg *msg) |
585 |
{ |
{ |
622 |
} |
} |
623 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
624 |
} |
} |
625 |
/*-----------------------------------------------------------------------------------*/ |
|
626 |
static void |
static void |
627 |
do_accept(struct api_msg_msg *msg) |
do_accept(struct api_msg_msg *msg) |
628 |
{ |
{ |
647 |
} |
} |
648 |
} |
} |
649 |
} |
} |
650 |
/*-----------------------------------------------------------------------------------*/ |
|
651 |
static void |
static void |
652 |
do_send(struct api_msg_msg *msg) |
do_send(struct api_msg_msg *msg) |
653 |
{ |
{ |
673 |
} |
} |
674 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
675 |
} |
} |
676 |
/*-----------------------------------------------------------------------------------*/ |
|
677 |
static void |
static void |
678 |
do_recv(struct api_msg_msg *msg) |
do_recv(struct api_msg_msg *msg) |
679 |
{ |
{ |
686 |
#endif |
#endif |
687 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
688 |
} |
} |
689 |
/*-----------------------------------------------------------------------------------*/ |
|
690 |
static void |
static void |
691 |
do_write(struct api_msg_msg *msg) |
do_write(struct api_msg_msg *msg) |
692 |
{ |
{ |
734 |
} |
} |
735 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
736 |
} |
} |
737 |
/*-----------------------------------------------------------------------------------*/ |
|
738 |
static void |
static void |
739 |
do_close(struct api_msg_msg *msg) |
do_close(struct api_msg_msg *msg) |
740 |
{ |
{ |
769 |
} |
} |
770 |
sys_mbox_post(msg->conn->mbox, NULL); |
sys_mbox_post(msg->conn->mbox, NULL); |
771 |
} |
} |
772 |
/*-----------------------------------------------------------------------------------*/ |
|
773 |
typedef void (* api_msg_decode)(struct api_msg_msg *msg); |
typedef void (* api_msg_decode)(struct api_msg_msg *msg); |
774 |
static api_msg_decode decode[API_MSG_MAX] = { |
static api_msg_decode decode[API_MSG_MAX] = { |
775 |
do_newconn, |
do_newconn, |
789 |
{ |
{ |
790 |
decode[msg->type](&(msg->msg)); |
decode[msg->type](&(msg->msg)); |
791 |
} |
} |
792 |
/*-----------------------------------------------------------------------------------*/ |
|
793 |
void |
void |
794 |
api_msg_post(struct api_msg *msg) |
api_msg_post(struct api_msg *msg) |
795 |
{ |
{ |
796 |
tcpip_apimsg(msg); |
tcpip_apimsg(msg); |
797 |
} |
} |
798 |
/*-----------------------------------------------------------------------------------*/ |
|
799 |
|
|
800 |
|
|