#include "lwip/opt.h"#include "lwip/arch.h"#include "lwip/api_msg.h"#include "lwip/memp.h"#include "lwip/sys.h"#include "lwip/tcpip.h"Include dependency graph for api_msg.c:
Go to the source code of this file.
Typedefs | |
| typedef void(* | api_msg_decode )(struct api_msg_msg *msg) |
Functions | |
| void | do_newconn (struct api_msg_msg *msg) |
| void | do_delconn (struct api_msg_msg *msg) |
| void | do_bind (struct api_msg_msg *msg) |
| void | do_connect (struct api_msg_msg *msg) |
| void | do_disconnect (struct api_msg_msg *msg) |
| void | do_listen (struct api_msg_msg *msg) |
| void | do_accept (struct api_msg_msg *msg) |
| void | do_send (struct api_msg_msg *msg) |
| void | do_recv (struct api_msg_msg *msg) |
| void | do_write (struct api_msg_msg *msg) |
| void | do_close (struct api_msg_msg *msg) |
| void | api_msg_input (struct api_msg *msg) |
| void | api_msg_post (struct api_msg *msg) |
Variables | |
| api_msg_decode | decode [API_MSG_MAX] |
|
|
|
|
|
Definition at line 644 of file api_msg.c. References decode, api_msg::msg, and api_msg::type. Referenced by tcpip_thread().
|
|
|
Definition at line 650 of file api_msg.c. References tcpip_apimsg(). Referenced by netconn_bind(), netconn_close(), netconn_connect(), netconn_delete(), netconn_disconnect(), netconn_listen(), netconn_recv(), netconn_send(), and netconn_write().
00651 {
00652 tcpip_apimsg(msg);
00653 }
|
Here is the call graph for this function:
|
|
Definition at line 502 of file api_msg.c. References API_MSG_DEBUG, api_msg_msg::conn, DEBUGF, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, and netconn::type.
00503 {
00504 if(msg->conn->pcb.tcp != NULL) {
00505 switch(msg->conn->type) {
00506 #if LWIP_UDP
00507 case NETCONN_UDPLITE:
00508 /* FALLTHROUGH */
00509 case NETCONN_UDPNOCHKSUM:
00510 /* FALLTHROUGH */
00511 case NETCONN_UDP:
00512 DEBUGF(API_MSG_DEBUG, ("api_msg: accept UDP: cannot accept for UDP.\n"));
00513 break;
00514 #endif /* LWIP_UDP */
00515 case NETCONN_TCP:
00516 break;
00517 }
00518 }
00519 }
|
|
|
Definition at line 298 of file api_msg.c. References api_msg_msg::conn, netconn::err, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_post(), tcp_bind(), tcp_new(), netconn::type, udp_bind(), UDP_FLAGS_NOCHKSUM, UDP_FLAGS_UDPLITE, udp_new(), udp_recv(), and udp_setflags.
00299 {
00300 if(msg->conn->pcb.tcp == NULL) {
00301 switch(msg->conn->type) {
00302 #if LWIP_UDP
00303 case NETCONN_UDPLITE:
00304 msg->conn->pcb.udp = udp_new();
00305 udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
00306 udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
00307 break;
00308 case NETCONN_UDPNOCHKSUM:
00309 msg->conn->pcb.udp = udp_new();
00310 udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
00311 udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
00312 break;
00313 case NETCONN_UDP:
00314 msg->conn->pcb.udp = udp_new();
00315 udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
00316 break;
00317 #endif /* LWIP_UDP */
00318 #if LWIP_TCP
00319 case NETCONN_TCP:
00320 msg->conn->pcb.tcp = tcp_new();
00321 setup_tcp(msg->conn);
00322 #endif /* LWIP_TCP */
00323 default:
00324 break;
00325 }
00326 }
00327 switch(msg->conn->type) {
00328 #if LWIP_UDP
00329 case NETCONN_UDPLITE:
00330 /* FALLTHROUGH */
00331 case NETCONN_UDPNOCHKSUM:
00332 /* FALLTHROUGH */
00333 case NETCONN_UDP:
00334 msg->conn->err = udp_bind(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
00335 break;
00336 #endif /* LWIP_UDP */
00337 #if LWIP_TCP
00338 case NETCONN_TCP:
00339 msg->conn->err = tcp_bind(msg->conn->pcb.tcp,
00340 msg->msg.bc.ipaddr, msg->msg.bc.port);
00341 #endif /* LWIP_TCP */
00342 default:
00343 break;
00344 }
00345 sys_mbox_post(msg->conn->mbox, NULL);
00346 }
|
Here is the call graph for this function:
|
|
Definition at line 599 of file api_msg.c. References api_msg_msg::conn, netconn::err, ERR_OK, err_t, LISTEN, netconn::mbox, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_post(), tcp_close(), and netconn::type.
00600 {
00601 err_t err;
00602
00603 err = ERR_OK;
00604
00605 if(msg->conn->pcb.tcp != NULL) {
00606 switch(msg->conn->type) {
00607 #if LWIP_UDP
00608 case NETCONN_UDPLITE:
00609 /* FALLTHROUGH */
00610 case NETCONN_UDPNOCHKSUM:
00611 /* FALLTHROUGH */
00612 case NETCONN_UDP:
00613 break;
00614 #endif /* LWIP_UDP */
00615 #if LWIP_TCP
00616 case NETCONN_TCP:
00617 if(msg->conn->pcb.tcp->state == LISTEN) {
00618 err = tcp_close(msg->conn->pcb.tcp);
00619 }
00620 msg->conn->err = err;
00621 #endif
00622 default:
00623 break;
00624 }
00625 }
00626 sys_mbox_post(msg->conn->mbox, NULL);
00627 }
|
Here is the call graph for this function:
|
|
Definition at line 370 of file api_msg.c. References api_msg_msg::conn, netconn::err, ERR_MEM, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_post(), tcp_connect(), tcp_new(), netconn::type, udp_connect(), UDP_FLAGS_NOCHKSUM, UDP_FLAGS_UDPLITE, udp_new(), udp_recv(), and udp_setflags.
00371 {
00372 if(msg->conn->pcb.tcp == NULL) {
00373 switch(msg->conn->type) {
00374 #if LWIP_UDP
00375 case NETCONN_UDPLITE:
00376 msg->conn->pcb.udp = udp_new();
00377 if(msg->conn->pcb.udp == NULL) {
00378 msg->conn->err = ERR_MEM;
00379 sys_mbox_post(msg->conn->mbox, NULL);
00380 return;
00381 }
00382 udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
00383 udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
00384 break;
00385 case NETCONN_UDPNOCHKSUM:
00386 msg->conn->pcb.udp = udp_new();
00387 if(msg->conn->pcb.udp == NULL) {
00388 msg->conn->err = ERR_MEM;
00389 sys_mbox_post(msg->conn->mbox, NULL);
00390 return;
00391 }
00392 udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
00393 udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
00394 break;
00395 case NETCONN_UDP:
00396 msg->conn->pcb.udp = udp_new();
00397 if(msg->conn->pcb.udp == NULL) {
00398 msg->conn->err = ERR_MEM;
00399 sys_mbox_post(msg->conn->mbox, NULL);
00400 return;
00401 }
00402 udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
00403 break;
00404 #endif /* LWIP_UDP */
00405 #if LWIP_TCP
00406 case NETCONN_TCP:
00407 msg->conn->pcb.tcp = tcp_new();
00408 if(msg->conn->pcb.tcp == NULL) {
00409 msg->conn->err = ERR_MEM;
00410 sys_mbox_post(msg->conn->mbox, NULL);
00411 return;
00412 }
00413 #endif
00414 default:
00415 break;
00416 }
00417 }
00418 switch(msg->conn->type) {
00419 #if LWIP_UDP
00420 case NETCONN_UDPLITE:
00421 /* FALLTHROUGH */
00422 case NETCONN_UDPNOCHKSUM:
00423 /* FALLTHROUGH */
00424 case NETCONN_UDP:
00425 udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
00426 sys_mbox_post(msg->conn->mbox, NULL);
00427 break;
00428 #endif
00429 #if LWIP_TCP
00430 case NETCONN_TCP:
00431 /* tcp_arg(msg->conn->pcb.tcp, msg->conn);*/
00432 setup_tcp(msg->conn);
00433 tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr, msg->msg.bc.port,
00434 do_connected);
00435 /*tcp_output(msg->conn->pcb.tcp);*/
00436 #endif
00437 default:
00438 break;
00439 }
00440 }
|
Here is the call graph for this function:
|
|
Definition at line 250 of file api_msg.c. References netconn::callback, api_msg_msg::conn, ERR_OK, LISTEN, netconn::mbox, NETCONN_EVT_RCVPLUS, NETCONN_EVT_SENDPLUS, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, SYS_MBOX_NULL, sys_mbox_post(), tcp_abort(), tcp_accept(), tcp_arg(), tcp_close(), tcp_err(), tcp_poll(), tcp_recv(), tcp_sent(), netconn::type, and udp_remove().
00251 {
00252 if(msg->conn->pcb.tcp != NULL) {
00253 switch(msg->conn->type) {
00254 #if LWIP_UDP
00255 case NETCONN_UDPLITE:
00256 /* FALLTHROUGH */
00257 case NETCONN_UDPNOCHKSUM:
00258 /* FALLTHROUGH */
00259 case NETCONN_UDP:
00260 msg->conn->pcb.udp->recv_arg = NULL;
00261 udp_remove(msg->conn->pcb.udp);
00262 break;
00263 #endif /* LWIP_UDP */
00264 #if LWIP_TCP
00265 case NETCONN_TCP:
00266 if(msg->conn->pcb.tcp->state == LISTEN) {
00267 tcp_arg(msg->conn->pcb.tcp, NULL);
00268 tcp_accept(msg->conn->pcb.tcp, NULL);
00269 tcp_close(msg->conn->pcb.tcp);
00270 } else {
00271 tcp_arg(msg->conn->pcb.tcp, NULL);
00272 tcp_sent(msg->conn->pcb.tcp, NULL);
00273 tcp_recv(msg->conn->pcb.tcp, NULL);
00274 tcp_poll(msg->conn->pcb.tcp, NULL, 0);
00275 tcp_err(msg->conn->pcb.tcp, NULL);
00276 if(tcp_close(msg->conn->pcb.tcp) != ERR_OK) {
00277 tcp_abort(msg->conn->pcb.tcp);
00278 }
00279 }
00280 #endif
00281 default:
00282 break;
00283 }
00284 }
00285 /* Trigger select() in socket layer */
00286 if (msg->conn->callback)
00287 {
00288 (*msg->conn->callback)(msg->conn, NETCONN_EVT_RCVPLUS, 0);
00289 (*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDPLUS, 0);
00290 }
00291
00292 if(msg->conn->mbox != SYS_MBOX_NULL) {
00293 sys_mbox_post(msg->conn->mbox, NULL);
00294 }
00295 }
|
Here is the call graph for this function:
|
|
Definition at line 443 of file api_msg.c. References api_msg_msg::conn, netconn::mbox, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_post(), netconn::type, and udp_disconnect().
00444 {
00445
00446 switch(msg->conn->type) {
00447 #if LWIP_UDP
00448 case NETCONN_UDPLITE:
00449 /* FALLTHROUGH */
00450 case NETCONN_UDPNOCHKSUM:
00451 /* FALLTHROUGH */
00452 case NETCONN_UDP:
00453 udp_disconnect(msg->conn->pcb.udp);
00454 break;
00455 #endif
00456 case NETCONN_TCP:
00457 break;
00458 }
00459 sys_mbox_post(msg->conn->mbox, NULL);
00460 }
|
Here is the call graph for this function:
|
|
Definition at line 464 of file api_msg.c. References netconn::acceptmbox, API_MSG_DEBUG, api_msg_msg::conn, DEBUGF, netconn::err, ERR_MEM, netconn::mbox, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_new(), SYS_MBOX_NULL, sys_mbox_post(), tcp_accept(), tcp_arg(), tcp_listen(), and netconn::type.
00465 {
00466 if(msg->conn->pcb.tcp != NULL) {
00467 switch(msg->conn->type) {
00468 #if LWIP_UDP
00469 case NETCONN_UDPLITE:
00470 /* FALLTHROUGH */
00471 case NETCONN_UDPNOCHKSUM:
00472 /* FALLTHROUGH */
00473 case NETCONN_UDP:
00474 DEBUGF(API_MSG_DEBUG, ("api_msg: listen UDP: cannot listen for UDP.\n"));
00475 break;
00476 #endif /* LWIP_UDP */
00477 #if LWIP_TCP
00478 case NETCONN_TCP:
00479 msg->conn->pcb.tcp = tcp_listen(msg->conn->pcb.tcp);
00480 if(msg->conn->pcb.tcp == NULL) {
00481 msg->conn->err = ERR_MEM;
00482 } else {
00483 if(msg->conn->acceptmbox == SYS_MBOX_NULL) {
00484 msg->conn->acceptmbox = sys_mbox_new();
00485 if(msg->conn->acceptmbox == SYS_MBOX_NULL) {
00486 msg->conn->err = ERR_MEM;
00487 break;
00488 }
00489 }
00490 tcp_arg(msg->conn->pcb.tcp, msg->conn);
00491 tcp_accept(msg->conn->pcb.tcp, accept_function);
00492 }
00493 #endif
00494 default:
00495 break;
00496 }
00497 }
00498 sys_mbox_post(msg->conn->mbox, NULL);
00499 }
|
Here is the call graph for this function:
|
|
Definition at line 245 of file api_msg.c.
00246 {
00247 }
|
|
|
Definition at line 543 of file api_msg.c. References api_msg_msg::conn, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NULL, netconn::pcb, sys_mbox_post(), tcp_recved(), and netconn::type.
00544 {
00545 #if LWIP_TCP
00546 if(msg->conn->pcb.tcp != NULL) {
00547 if(msg->conn->type == NETCONN_TCP) {
00548 tcp_recved(msg->conn->pcb.tcp, msg->msg.len);
00549 }
00550 }
00551 #endif
00552 sys_mbox_post(msg->conn->mbox, NULL);
00553 }
|
Here is the call graph for this function:
|
|
Definition at line 522 of file api_msg.c. References api_msg_msg::conn, netconn::mbox, api_msg_msg::msg, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_post(), netconn::type, and udp_send().
00523 {
00524 if(msg->conn->pcb.tcp != NULL) {
00525 switch(msg->conn->type) {
00526 #if LWIP_UDP
00527 case NETCONN_UDPLITE:
00528 /* FALLTHROUGH */
00529 case NETCONN_UDPNOCHKSUM:
00530 /* FALLTHROUGH */
00531 case NETCONN_UDP:
00532 udp_send(msg->conn->pcb.udp, msg->msg.p);
00533 break;
00534 #endif /* LWIP_UDP */
00535 case NETCONN_TCP:
00536 break;
00537 }
00538 }
00539 sys_mbox_post(msg->conn->mbox, NULL);
00540 }
|
Here is the call graph for this function:
|
|
Definition at line 556 of file api_msg.c. References netconn::callback, api_msg_msg::conn, netconn::err, ERR_OK, err_t, ERR_VAL, netconn::mbox, api_msg_msg::msg, NETCONN_EVT_SENDMINUS, NETCONN_TCP, NETCONN_UDP, NETCONN_UDPLITE, NETCONN_UDPNOCHKSUM, NULL, netconn::pcb, sys_mbox_post(), tcp_output(), tcp_sndbuf, TCP_SNDLOWAT, tcp_write(), and netconn::type.
00557 {
00558 #if LWIP_TCP
00559 err_t err;
00560 #endif
00561 if(msg->conn->pcb.tcp != NULL) {
00562 switch(msg->conn->type) {
00563 #if LWIP_UDP
00564 case NETCONN_UDPLITE:
00565 /* FALLTHROUGH */
00566 case NETCONN_UDPNOCHKSUM:
00567 /* FALLTHROUGH */
00568 case NETCONN_UDP:
00569 msg->conn->err = ERR_VAL;
00570 break;
00571 #endif /* LWIP_UDP */
00572 #if LWIP_TCP
00573 case NETCONN_TCP:
00574 err = tcp_write(msg->conn->pcb.tcp, msg->msg.w.dataptr,
00575 msg->msg.w.len, msg->msg.w.copy);
00576 /* This is the Nagle algorithm: inhibit the sending of new TCP
00577 segments when new outgoing data arrives from the user if any
00578 previously transmitted data on the connection remains
00579 unacknowledged. */
00580 if(err == ERR_OK && msg->conn->pcb.tcp->unacked == NULL) {
00581 tcp_output(msg->conn->pcb.tcp);
00582 }
00583 msg->conn->err = err;
00584 if (msg->conn->callback)
00585 if (err == ERR_OK)
00586 {
00587 if (tcp_sndbuf(msg->conn->pcb.tcp) <= TCP_SNDLOWAT)
00588 (*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDMINUS, msg->msg.w.len);
00589 }
00590 #endif
00591 default:
00592 break;
00593 }
00594 }
00595 sys_mbox_post(msg->conn->mbox, NULL);
00596 }
|
Here is the call graph for this function:
|
|
Initial value: {
do_newconn,
do_delconn,
do_bind,
do_connect,
do_disconnect,
do_listen,
do_accept,
do_send,
do_recv,
do_write,
do_close
}
Definition at line 630 of file api_msg.c. Referenced by api_msg_input(). |
1.3.4